Angular2 Dart build gives "The selector "demo-app" did not match any elements" error

Issue

I’m porting an existing angular2 ts library to Dart.
Everything’s working in Dartium but after building the app won’t run in Chrome.

I’m getting an “The selector “demo-app” did not match any elements” error.

Not sure how to debug, any help would be appreciated!

Please see https://github.com/laagland/ng2-dart-pagination for the code.

Solution

- dart_to_js_script_rewriter

should be the last transformer.
Also add this setting to the Angular transformer

 - angular2:
platform_directives: 'package:angular2/common.dart#CORE_DIRECTIVES'

See https://github.com/kwalrath/angular.io/blob/d87fb0995aafe5da1c2be708986d74828b65d55c/public/docs/_examples/forms/dart/pubspec.yaml for an example.

You should try to avoid mirrors in browser applications because it causes code bloat. I didn’t chech all your code, but I saw the @MirrorsUsed annotation. If you need reflection, use the reflectable package instead.

Answered By – Günter Zöchbauer

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.