Closed taisph closed 10 years ago
Try annotating your TestRouter with @Injectable(). I haven't checked but I believe this should solve your problem. On 01/07/2014 6:05 PM, "Tais Plougmann Hansen" notifications@github.com wrote:
I'm getting the following error when using the angular transformer in pubspec.yaml under dart-1.5.1 with the code below. Removing the transformer "fixes" the problem. Error does not occur in dart-1.4.
Illegal argument(s): No type factory provided for TestRouter! (resolving RouteInitializerFn)
STACKTRACE:
0 StaticInjector.newInstanceOf (package:di/static_injector.dart:36:7)
1 TypeProvider.get (package:di/src/provider.dart:36:34)
2 BaseInjector.getInstanceByKey (package:di/src/base_injector.dart:117:29)
3 BaseInjector.get (package:di/src/base_injector.dart:158:23)
4 NgRoutingHelper.NgRoutingHelper (package:angular/routing/routing.dart:133:52)
5 factories.
(http://127.0.0.1:8080/main_static_injector.dart:127:41) 6 StaticInjector.newInstanceOf (package:di/static_injector.dart:39:23)
7 TypeProvider.get (package:di/src/provider.dart:36:34)
8 BaseInjector.getInstanceByKey (package:di/src/base_injector.dart:117:29)
9 BaseInjector.getInstanceByKey (package:di/src/base_injector.dart:113:39)
10 BaseInjector.get (package:di/src/base_injector.dart:158:23)
11 NgView.NgView (package:angular/routing/ng_view.dart:76:40)
12 factories.
(http://127.0.0.1:8080/main_static_injector.dart:128:32) 13 StaticInjector.newInstanceOf (package:di/static_injector.dart:39:23)
14 TypeProvider.get (package:di/src/provider.dart:36:34)
15 BaseInjector.getInstanceByKey (package:di/src/base_injector.dart:117:29)
16 BaseInjector.getByKey (package:di/src/base_injector.dart:162:23)
17 ElementBinder._link.
(package:angular/core_dom/element_binder.dart:206:44) 18 List.forEach (dart:core-patch/growable_array.dart:227)
19 ElementBinder._link (package:angular/core_dom/element_binder.dart:205:33)
20 ElementBinder.bind (package:angular/core_dom/element_binder.dart:324:10)
21 TaggingViewFactory._bindTagged (package:angular/core_dom/tagging_view_factory.dart:38:37)
22 TaggingViewFactory._link (package:angular/core_dom/tagging_view_factory.dart:76:22)
23 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:22:12)
24 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:24:7)
25 TaggingViewFactory.call (package:angular/core_dom/tagging_view_factory.dart:24:7)
26 Application.run.
. (package:angular/application.dart:172:22) 27 _rootRunUnary (dart:async/zone.dart:730)
28 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
29 _onRunUnary.
(package:angular/core/zone.dart:113:63) 30 VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
31 _onRunUnary (package:angular/core/zone.dart:113:17)
32 _ZoneDelegate.runUnary (dart:async/zone.dart:462)
33 _CustomizedZone.runUnary (dart:async/zone.dart:667)
34 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
35 _Future._propagateToListeners (dart:async/future_impl.dart:571)
36 _Future._completeWithValue (dart:async/future_impl.dart:331)
37 _Future._asyncComplete.
(dart:async/future_impl.dart:393) 38 _rootRun (dart:async/zone.dart:723)
39 _ZoneDelegate.run (dart:async/zone.dart:453)
40 _onScheduleMicrotask.
(package:angular/core/zone.dart:117:43) 41 VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
42 VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
43 _onRun (package:angular/core/zone.dart:109:17)
44 _ZoneDelegate.run (dart:async/zone.dart:453)
45 _CustomizedZone.run (dart:async/zone.dart:663)
46 VmTurnZone.run (package:angular/core/zone.dart:221:40)
47 Application.run (package:angular/application.dart:164:20)
48 main (http://127.0.0.1:8080/main.dart:31:9)
main.dart
library angular_dart_transformer; import 'package:angular/angular.dart';import 'package:angular/application_factory.dart'; class TestModule extends Module { TestModule() { bind(RouteInitializerFn, toImplementation: TestRouter); }} class TestRouter { TestRouter();
void call(Router router, RouteViewFactory views) { views.configure({ 'home': ngRoute( path: '/home', view: 'home.html', defaultRoute: true) }); }} void main() { applicationFactory() .addModule(new TestModule()) .run();}
index.html
<!DOCTYPE html>
Angular_dart_transformer pubspec.yaml name: angular_dart_transformer description: A sample application dependencies: angular: '>=0.12.0 <0.13.0' transformers: - angular — Reply to this email directly or view it on GitHub https://github.com/angular/angular.dart/issues/1192.
@markovuksanovic That actually fixes it. Thanks!
I completely forgot about the annotations in the hunt for the cause of this problem. I was thrown off it because it used-to-work™.
I'm getting the following error when using the angular transformer in pubspec.yaml under dart-1.5.1 with the code below. Removing the transformer "fixes" the problem. Error does not occur in dart-1.4.
main.dart
index.html
pubspec.yaml