1

I have a podo class CarStorage for angular to inject.

class CarStorage {
  int _carIdCounter = 0;
  ...

I wire it in using type:

module
    ..type(CarForm)
    ..type(CarItemsList)
    ..type(CarStorage)
    ;

It works in dartium but fails to load in dart2js. I get the following error:

Illegal argument(s): No type factory provided for CarStorage! (resolving GarageAppController -> CarStorage)

1 Answer 1

2

I discovered through some bug reports and guess work you need to add the DI Injectable annotation:

import "package:angular/angular.dart";

@Injectable()
class CarStorage {
  ...

edit: Fixed the import.
Do NOT use import 'package:di/annotations.dart'; this causes errors

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the follow up. I had the same problem. AngularDart's documentation really is poor, isn't it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.