/** * @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, Directive, EventEmitter, Input, Output} from '@angular/core'; import {Hero} from './app.component'; @Component({ template: `

Some <~{incomplete-open-lt}a~{incomplete-open-a} ~{incomplete-open-attr} text

`, }) export class CaseIncompleteOpen { } @Component({ template: '

Some ~{missing-closing} text

', }) export class CaseMissingClosing { } @Component({ template: '

Some text

', }) export class CaseUnknown { } @Component({ template: '

{{data | ~{before-pipe}lowe~{in-pipe}rcase~{after-pipe} }}', }) export class Pipes { data = 'Some string'; } @Component({ template: '

', }) export class NoValueAttribute { } @Component({ template: '

', }) export class AttributeBinding { test: string = 'test'; } @Component({ template: '

', }) export class PropertyBinding { test: string = 'test'; } @Component({ template: '

', }) export class EventBinding { test: string = 'test'; modelChanged() {} } @Component({ template: `

`, }) export class TwoWayBinding { test: string = 'test'; } @Directive({ selector: '[string-model]', }) export class StringModel { @Input() model: string = 'model'; @Output() modelChange: EventEmitter = new EventEmitter(); } @Directive({ selector: '[number-model]', }) export class NumberModel { @Input('inputAlias') model: number = 0; @Output('outputAlias') modelChange: EventEmitter = new EventEmitter(); } @Component({ selector: 'foo-component', template: `
`, }) export class FooComponent { text: string = 'some text'; value: number = 42; } interface Person { name: string; age: number; street: string; } @Component({ template: '
', }) export class ForOfLetEmpty { } @Component({ template: '
', }) export class ForLetIEqual { } @Component({ template: `
Name: {{~{for-interp-person}person.~{for-interp-name}name}} Age: {{person.~{for-interp-age}age}}
`, }) export class ForUsingComponent { people: Person[] = []; } @Component({ template: `
{{person.~{async-person-name}name}}
{{person.~{promised-person-name}name}}
`, }) export class AsyncForUsingComponent { people: Promise = Promise.resolve([]); promisedPerson: Promise = Promise.resolve({ name: 'John Doe', age: 42, street: '123 Angular Ln', }); } @Component({ template: `
{{~{test-comp-content}}} {{test1.~{test-comp-after-test}name}} {{div.~{test-comp-after-div}.innerText}}
`, }) export class References { } /*BeginTestComponent*/ @Component({ selector: 'test-comp', template: '
Testing: {{name}}
', }) export class TestComponent { @Input('tcName') name = 'test'; @Output('test') testEvent = new EventEmitter(); } /*EndTestComponent*/ @Component({ templateUrl: 'test.ng', }) export class TemplateReference { title = 'Some title'; hero: Hero = {id: 1, name: 'Windstorm'}; heroes: Hero[] = [this.hero]; tupleArray: [string, Hero] = ['test', this.hero]; league: Hero[][] = [this.heroes]; heroesByName: {[name: string]: Hero} = {}; primitiveIndexType: {[name: string]: string} = {}; anyValue: any; myClick(event: any) {} } @Component({ template: '{{~{empty-interpolation}}}', }) export class EmptyInterpolation { title = 'Some title'; subTitle = 'Some sub title'; }