fix(di): allow injecting event emitter fns without specifying type annotation
Fixes #965 Closes #1155
This commit is contained in:
8
modules/angular2/src/core/annotations/di.js
vendored
8
modules/angular2/src/core/annotations/di.js
vendored
@ -12,6 +12,10 @@ export class EventEmitter extends DependencyAnnotation {
|
||||
super();
|
||||
this.eventName = eventName;
|
||||
}
|
||||
|
||||
get token() {
|
||||
return Function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -25,6 +29,10 @@ export class PropertySetter extends DependencyAnnotation {
|
||||
super();
|
||||
this.propName = propName;
|
||||
}
|
||||
|
||||
get token() {
|
||||
return Function;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
4
modules/angular2/src/di/annotations.js
vendored
4
modules/angular2/src/di/annotations.js
vendored
@ -107,6 +107,10 @@ export class DependencyAnnotation {
|
||||
@CONST()
|
||||
constructor() {
|
||||
}
|
||||
|
||||
get token() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
4
modules/angular2/src/di/binding.js
vendored
4
modules/angular2/src/di/binding.js
vendored
@ -135,7 +135,11 @@ function _extractToken(typeOrFunc, annotations) {
|
||||
optional = true;
|
||||
|
||||
} else if (paramAnnotation instanceof DependencyAnnotation) {
|
||||
if (isPresent(paramAnnotation.token)) {
|
||||
token = paramAnnotation.token;
|
||||
}
|
||||
ListWrapper.push(depProps, paramAnnotation);
|
||||
|
||||
} else if (paramAnnotation.name === "string") {
|
||||
token = paramAnnotation;
|
||||
}
|
||||
|
Reference in New Issue
Block a user