refactor: move angular source to /packages rather than modules/@angular
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
import {$, ExpectedConditions, browser, by, element} from 'protractor';
|
||||
import {verifyNoBrowserErrors} from '../../../../_common/e2e_util';
|
||||
|
||||
function waitForElement(selector: string) {
|
||||
const EC = ExpectedConditions;
|
||||
// Waits for the element with id 'abc' to be present on the dom.
|
||||
browser.wait(EC.presenceOf($(selector)), 20000);
|
||||
}
|
||||
|
||||
describe('ngTemplateOutlet', () => {
|
||||
const URL = 'common/ngTemplateOutlet/ts/';
|
||||
afterEach(verifyNoBrowserErrors);
|
||||
|
||||
describe('ng-template-outlet-example', () => {
|
||||
it('should render', () => {
|
||||
browser.get(URL);
|
||||
waitForElement('ng-template-outlet-example');
|
||||
expect(element.all(by.css('ng-template-outlet-example span')).getText()).toEqual([
|
||||
'Hello', 'Hello World!', 'Ahoj Svet!'
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
49
packages/examples/common/ngTemplateOutlet/ts/module.ts
Normal file
49
packages/examples/common/ngTemplateOutlet/ts/module.ts
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
import {Component, NgModule, OnInit, TemplateRef, ViewChild} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
|
||||
|
||||
// #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>
|
||||
|
||||
<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>
|
||||
`
|
||||
})
|
||||
class NgTemplateOutletExample {
|
||||
myContext = {$implicit: 'World', localSk: 'Svet'};
|
||||
}
|
||||
// #enddocregion
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'example-app',
|
||||
template: `<ng-template-outlet-example></ng-template-outlet-example>`
|
||||
})
|
||||
class ExampleApp {
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [BrowserModule],
|
||||
declarations: [ExampleApp, NgTemplateOutletExample],
|
||||
bootstrap: [ExampleApp]
|
||||
})
|
||||
export class AppModule {
|
||||
}
|
Reference in New Issue
Block a user