2016-12-12 00:42:20 -05:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2016-12-12 00:42:20 -05:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
|
2018-02-27 17:06:06 -05:00
|
|
|
import {Component, NgModule} from '@angular/core';
|
2016-12-12 00:42:20 -05:00
|
|
|
import {BrowserModule} from '@angular/platform-browser';
|
|
|
|
|
|
|
|
|
|
|
|
// #docregion NgTemplateOutlet
|
|
|
|
@Component({
|
|
|
|
selector: 'ng-template-outlet-example',
|
|
|
|
template: `
|
|
|
|
<ng-container *ngTemplateOutlet="greet"></ng-container>
|
|
|
|
<hr>
|
|
|
|
<ng-container *ngTemplateOutlet="eng; context: myContext"></ng-container>
|
|
|
|
<hr>
|
|
|
|
<ng-container *ngTemplateOutlet="svk; context: myContext"></ng-container>
|
|
|
|
<hr>
|
2020-05-19 15:08:49 -04:00
|
|
|
|
2017-01-09 16:16:46 -05:00
|
|
|
<ng-template #greet><span>Hello</span></ng-template>
|
|
|
|
<ng-template #eng let-name><span>Hello {{name}}!</span></ng-template>
|
|
|
|
<ng-template #svk let-person="localSk"><span>Ahoj {{person}}!</span></ng-template>
|
2016-12-12 00:42:20 -05:00
|
|
|
`
|
|
|
|
})
|
2019-01-28 15:59:25 -05:00
|
|
|
export class NgTemplateOutletExample {
|
2016-12-12 00:42:20 -05:00
|
|
|
myContext = {$implicit: 'World', localSk: 'Svet'};
|
|
|
|
}
|
|
|
|
// #enddocregion
|
|
|
|
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'example-app',
|
|
|
|
template: `<ng-template-outlet-example></ng-template-outlet-example>`
|
|
|
|
})
|
2019-01-28 15:59:25 -05:00
|
|
|
export class AppComponent {
|
2016-12-12 00:42:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@NgModule({
|
|
|
|
imports: [BrowserModule],
|
2019-01-28 15:59:25 -05:00
|
|
|
declarations: [AppComponent, NgTemplateOutletExample],
|
2016-12-12 00:42:20 -05:00
|
|
|
})
|
|
|
|
export class AppModule {
|
|
|
|
}
|