File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,11 @@ export class Injector {
141141 this . _syncStrategy = new _SyncInjectorStrategy ( this ) ;
142142 }
143143
144+ /**
145+ * Direct parent of this injector.
146+ */
147+ get parent ( ) : Injector { return this . _parent ; }
148+
144149 /**
145150 * Retrieves an instance from the injector.
146151 *
Original file line number Diff line number Diff line change @@ -348,6 +348,12 @@ export function main() {
348348
349349 expect ( childCar ) . toBe ( parentCar ) ;
350350 } ) ;
351+
352+ it ( "should give access to direct parent" , ( ) => {
353+ var parent = Injector . resolveAndCreate ( [ ] ) ;
354+ var child = parent . resolveAndCreateChild ( [ ] ) ;
355+ expect ( child . parent ) . toBe ( parent ) ;
356+ } ) ;
351357 } ) ;
352358
353359 describe ( "lazy" , function ( ) {
You can’t perform that action at this time.
0 commit comments