feat(element_injector): allow @Optional for ProtoViewRef

This commit is contained in:
Jeremy Elbourn
2015-05-15 16:10:16 -07:00
parent 0114cd97b6
commit bb2eda2d15
2 changed files with 17 additions and 0 deletions

View File

@ -851,6 +851,10 @@ export class ElementInjector extends TreeNode {
}
if (dep.key.id === StaticKeys.instance().protoViewId) {
if (isBlank(this._preBuiltObjects.protoView)) {
if (dep.optional) {
return null;
}
throw new NoBindingError(dep.key);
}
return new ProtoViewRef(this._preBuiltObjects.protoView);