Angular 2.0 Dart with Transformer and Router

378 views Asked by At

Running into an weird issue when I use Angular 2.0 Dart. Basically I'm trying to use Router and using pub serve to transform it to JS using the angular transformer. However I get the following error

Cannot find reflection information on RouteRegistry
    at dart.wrapException (http://localhost:8080/main.dart.js:2834:17)
    at NoReflectionCapabilities.dart.NoReflectionCapabilities.factory$1 (http://localhost:8080/main.dart.js:31991:17)
    at Reflector.dart.Reflector.factory$1 (http://localhost:8080/main.dart.js:15565:46)
    at Binding.dart.Binding.resolve$0 (http://localhost:8080/main.dart.js:13499:41)
    at dart.resolveBindings (http://localhost:8080/main.dart.js:13766:90)
    at dart.Injector.static.Injector_resolve (http://localhost:8080/main.dart.js:13898:63)
    at bootstrap_closure.dart.bootstrap_closure.call$0 (http://localhost:8080/main.dart.js:9374:37)
    at dart._rootRun (http://localhost:8080/main.dart.js:20637:16)
    at _ZoneDelegate.dart._ZoneDelegate.run$2 (http://localhost:8080/main.dart.js:22730:41)
    at NgZone.dart.NgZone._run$4 (http://localhost:8080/main.dart.js:5098:24)

But removing the transformer

- angular2:
    entry_points: web/main.dart

I can see my app and navigate through the routes properly, however the downside is that my Dart2JS file is now 2.8megs

3

There are 3 answers

0
Faisal Abid On BEST ANSWER

Currently as of Alpha 28, this is not supported. Alpha 30 will have this fixed.

https://github.com/angular/angular/issues/1950

1
Christoph Lachenicht On

You could add "mirror_mode: verbose" to the angular2 transformer.

0
Jake MacDonald On

Does RouteRegistry come from a different package? If so make sure the angular transformer has also been added to that package (it doesn't have to specify any entry points). The new angular transformer works a lot differently than the old one and it is required on all packages, not just the application package.