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
| import { Component } from '@angular/core'; | |
| import { ControlContainer, NgForm } from '@angular/forms'; | |
| @Component({ | |
| selector: 'address', | |
| template: ` | |
| <fieldset ngModelGroup="address"> | |
| <div> | |
| <label>Zip:</label> |
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
| ng.probe(getAllAngularRootElements()[0]).injector.view.root.ngModule._providers |
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 platform = platformBrowserDynamic([ { | |
| provide: SharedService, | |
| deps:[] | |
| }]); | |
| platform.bootstrapModule(AppModule); | |
| platform.bootstrapModule(AppModule2); |
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
| ng.probe(getAllAngularRootElements()[0]).injector.view.root.ngModule._parent.parent._records; | |
| // to see stringified value use | |
| ng.probe(getAllAngularRootElements()[0]).injector.view.root.ngModule._parent.parent.toString() |
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
| function createRootData( | |
| elInjector: Injector, ngModule: NgModuleRef<any>, rendererFactory: RendererFactory2, | |
| projectableNodes: any[][], rootSelectorOrNode: any): RootData { | |
| const sanitizer = ngModule.injector.get(Sanitizer); | |
| const errorHandler = ngModule.injector.get(ErrorHandler); | |
| const renderer = rendererFactory.createRenderer(null, null); | |
| return { | |
| ngModule, | |
| injector: elInjector, projectableNodes, | |
| selectorOrNode: rootSelectorOrNode, sanitizer, rendererFactory, renderer, errorHandler |
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: `<child></child>`, | |
| }) | |
| export class AppComponent {} | |
| @Component({ | |
| selector: 'child', | |
| template: `<grand-child></grand-child>` | |
| }) |
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
| platformBrowserDynamic().bootstrapModule(AppModule); |
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 compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, 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
| @Directive({ | |
| selector: '[someDir]' | |
| } | |
| export class SomeDirective { | |
| constructor(private injector: 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
| class Injector_ implements Injector { | |
| constructor(private view: ViewData, private elDef: NodeDef|null) {} | |
| get(token: any, notFoundValue: any = Injector.THROW_IF_NOT_FOUND): any { | |
| const allowPrivateServices = | |
| this.elDef ? (this.elDef.flags & NodeFlags.ComponentView) !== 0 : false; | |
| return Services.resolveDep( | |
| this.view, this.elDef, allowPrivateServices, | |
| {flags: DepFlags.None, token, tokenKey: tokenKey(token)}, notFoundValue); | |
| } | |
| } |