Tuan Hoang Anh
Tuan Hoang Anh

Reputation: 994

AngularDart v0.14.0 Error: Type 'xxx' not found in generated typeFactory maps when run pub server

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);
...
}

Upvotes: 2

Views: 551

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 658007

As far as I know you need to add the @Injectable annotation to your CurrencyService class.

@Injectable()
class CurrencyService {

Upvotes: 1

Related Questions