File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 11import { Container } from 'container-ioc' ;
22
3+ /*
4+ If a container can't find a value within itself, it will look it up in ascendant containers.
5+ There a 3 ways to set a parent for a container:
6+ */
7+
38const grandParentContainer = new Container ( ) ;
49
10+ // 1.
511const parentContainer = grandParentContainer . createChild ( ) ;
612
13+ // 2.
714const childContainer = new Container ( ) ;
815childContainer . setParent ( parentContainer ) ;
916
17+ // 3.
1018const deepNestedContainer = new Container ( {
1119 parent : childContainer
1220} ) ;
Original file line number Diff line number Diff line change 11import { Container } from 'container-ioc' ;
22
3+ /*
4+ If a container can't find a value within itself, it will look it up in ascendant containers.
5+ There a 3 ways to set a parent for a container:
6+ */
7+
38const grandParentContainer = new Container ( ) ;
49
10+ // 1.
511const parentContainer = grandParentContainer . createChild ( ) ;
612
13+ // 2.
714const childContainer = new Container ( ) ;
815childContainer . setParent ( parentContainer ) ;
916
17+ // 3.
1018const deepNestedContainer = new Container ( {
1119 parent : childContainer
1220} ) ;
You can’t perform that action at this time.
0 commit comments