File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -854,6 +854,7 @@ export class ElementInjector extends TreeNode<ElementInjector> implements Depend
854854 getBoundElementIndex ( ) : number { return this . _proto . index ; }
855855
856856 getRootViewInjectors ( ) : ElementInjector [ ] {
857+ if ( ! this . hydrated ) return [ ] ;
857858 var view = this . _preBuiltObjects . view ;
858859 var nestedView = view . getNestedView ( view . elementOffset + this . getBoundElementIndex ( ) ) ;
859860 return isPresent ( nestedView ) ? nestedView . rootElementInjectors : [ ] ;
Original file line number Diff line number Diff line change @@ -864,6 +864,12 @@ export function main() {
864864 var inj = injector ( extraBindings ) ;
865865 expect ( inj . getRootViewInjectors ( ) ) . toEqual ( [ ] ) ;
866866 } ) ;
867+
868+ it ( "should return an empty array on a dehydrated view" , ( ) => {
869+ var inj = injector ( extraBindings ) ;
870+ inj . dehydrate ( ) ;
871+ expect ( inj . getRootViewInjectors ( ) ) . toEqual ( [ ] ) ;
872+ } ) ;
867873 } ) ;
868874
869875 describe ( "dehydrate" , ( ) => {
You can’t perform that action at this time.
0 commit comments