Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top