Compiled AngularDart fails with error in dynamic_injector

无人久伴 提交于 2019-12-23 02:18:30

问题


I have been trying to make AngularDart work but I always get exceptions for undefined objects.

@MirrorsUsed(
targets: const [
    'angular.core',
    'angular.core.dom',
    'angular.core.parser',
    'angular.routing',
    'angular.core.zone',
    'di.di',
    'di.dynamic_injector',
    NodeTreeSanitizer,
    DynamicParser,
    DynamicParserBackend,
    Injector
],
metaTargets: const [
    NgInjectableService,
    NgComponent,
    NgDirective,
    NgController,
    NgFilter,
    NgAttr,
    NgOneWay,
    NgOneWayOneTime,
    NgTwoWay,
    NgCallback,
    NgZone
],
override: '*'
)
import 'dart:mirrors';

And compiled javascript showing error:

Uncaught TypeError: Cannot call method 'get$parameters' of undefined dynamic_injector.dart:42
DynamicInjector.newInstanceOf$4 dynamic_injector.dart:42

When I'm removing MirrorsUsed2 there is no errors, but compiled file is large.


回答1:


Adding these helped for me

    'angular.filter',
    'angular.perf',
    'perf_api',

and instead of angular.core.parser

    'angular.core.parser.dynamic_parser'
    'angular.core.parser.lexer'

I also added all my own libraries.

See also https://code.google.com/p/dart/issues/detail?id=14686




回答2:


Recently, I found Dart-AngularJS when compiled not to run, even the simplest example. I reinstalled my dart sdk to the latest stable version and the errors disappeared. Could you see if this works? Please see related issue on github project.



来源:https://stackoverflow.com/questions/21212131/compiled-angulardart-fails-with-error-in-dynamic-injector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!