I test my app on AngularDart v0.14.0 pub server but it has error
Exception: Uncaught Error: Type 'CurrencyService' not found in generated typeFactory maps. Is the type's constructor injectable and annotated for injection?
Stack Trace:
#0 GeneratedTypeFactories.parameterKeysFor (package:di/src/reflector_static.dart:26:5)
#1 Binding.bind (package:di/src/module.dart:61:49)
#2 Module.bindByKey (package:di/src/module.dart:136:17)
#3 Module.bind (package:di/src/module.dart:124:14)
#4 CERPModule.CERPModule (http://localhost:8080/index.dart:71:9)
#5 main.<anonymous closure> (http://localhost:8080/index.dart:59:201)
#6 _RootZone.runUnary (dart:async/zone.dart:1082)
#7 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
#8 _Future._propagateToListeners (dart:async/future_impl.dart:571)
#9 _Future._completeWithValue (dart:async/future_impl.dart:331)
#10 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
#11 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#12 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#13 _handleMutation (dart:html:39006)
When run in localhost:3030 this error don't occur.
Here is my Module
class CERPModule extends Module {
...
bind(CurrencyService);
...
}
Here is my CurrencyService
library cerp_currency_service;
import 'dart:async';
import 'dart:convert';
import 'package:angular/angular.dart';
class CurrencyService {
Http _http;
CurrencyService (Http this._http);
...
}
As far as I know you need to add the @Injectable
annotation to your CurrencyService
class.
@Injectable()
class CurrencyService {
来源:https://stackoverflow.com/questions/25575880/angulardart-v0-14-0-error-type-xxx-not-found-in-generated-typefactory-maps-wh