This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface ElementDef { | |
... | |
/** | |
* visible public providers for DI in the view, | |
* as see from this element. This does not include private providers. | |
*/ | |
publicProviders: {[tokenKey: string]: NodeDef}|null; | |
/** | |
* same as visiblePublicProviders, but also includes private providers | |
* that are located on this element. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const providerDef = | |
(allowPrivateServices ? elDef.element!.allProviders : | |
elDef.element!.publicProviders)![tokenKey]; | |
if (providerDef) { | |
let providerData = asProviderData(searchView, providerDef.nodeIndex); | |
if (!providerData) { | |
providerData = { instance: _createProviderInstance(searchView, providerDef) }; | |
searchView.nodes[providerDef.nodeIndex] = providerData as any; | |
} | |
return providerData.instance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* for component views, this is the host element. | |
* for embedded views, this is the index of the parent node | |
* that contains the view container. | |
*/ | |
export function viewParentEl(view: ViewData): NodeDef|null { | |
const parentView = view.parent; | |
if (parentView) { | |
return view.parentNodeDef !.parent; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'my-list', | |
template: ` | |
<div class="container"> | |
<grid-list *ngIf="1"> | |
<grid-tile>1</grid-tile> | |
<grid-tile>2</grid-tile> | |
<grid-tile>3</grid-tile> | |
</grid-list> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'my-app', | |
template: `<my-list></my-list>` | |
}) | |
export class AppComponent {} | |
@Component({ | |
selector: 'my-list', | |
template: ` | |
<div class="container"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'my-app', | |
template: `<router-outlet></router-outlet>`, | |
}) | |
export class AppComponent {} | |
... | |
@NgModule({ | |
imports: [ | |
BrowserModule, | |
RouterModule.forRoot([ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const injector = new OutletInjector(activatedRoute, childContexts, this.location.injector); | |
this.activated = this.location.createComponent(factory, this.location.length, injector); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'child', | |
template: ` | |
Child | |
<router-outlet></router-outlet> | |
` | |
}) | |
export class ChildComponent {} | |
... | |
@NgModule({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startView.root.ngModule.injector.get(depDef.token, notFoundValue); |