fix(di): allow injecting static attrs without type annotations
Closes #1226
This commit is contained in:
8
modules/angular2/src/core/annotations/di.js
vendored
8
modules/angular2/src/core/annotations/di.js
vendored
@ -45,4 +45,12 @@ export class Attribute extends DependencyAnnotation {
|
||||
super();
|
||||
this.attributeName = attributeName;
|
||||
}
|
||||
|
||||
get token() {
|
||||
//Normally one would default a token to a type of an injected value but here
|
||||
//the type of a variable is "string" and we can't use primitive type as a return value
|
||||
//so we use instance of Attribute instead. This doesn't matter much in practice as arguments
|
||||
//with @Attribute annotation are injected by ElementInjector that doesn't take tokens into account.
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
2
modules/angular2/src/di/binding.js
vendored
2
modules/angular2/src/di/binding.js
vendored
@ -140,8 +140,6 @@ function _extractToken(typeOrFunc, annotations) {
|
||||
}
|
||||
ListWrapper.push(depProps, paramAnnotation);
|
||||
|
||||
} else if (paramAnnotation.name === "string") {
|
||||
token = paramAnnotation;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user