NoAnnotationError

export class NoAnnotationError

exported from angular2/core defined in angular2/src/core/di/exceptions.ts (line 180)

Thrown when the class has no annotation information.

Lack of annotation information prevents the Injector from determining which dependencies need to be injected into the constructor.

Example (live demo)

class A { constructor(b) {} } expect(() => Injector.resolveAndCreate([A])).toThrowError();

This error is also thrown when the class not marked with Injectable has parameter types.

class B {} class A { constructor(b:B) {} // no information about the parameter types of A is available at runtime. } expect(() => Injector.resolveAndCreate([A,B])).toThrowError();

Constructor

constructor(typeOrFunc: any, params: any[][])

Not Yet Documented