Files
Angular-Docs-Cn/aio/content/examples/structural-directives/src/app/app.component.ts
T

24 lines
500 B
TypeScript

// #docregion
import { Component } from '@angular/core';
import { Hero, heroes } from './hero';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
heroes = heroes;
hero = this.heroes[0];
condition = false;
logs: string[] = [];
showSad = true;
status = 'ready';
// #docregion trackByHero
trackById(index: number, hero: Hero): number { return hero.id; }
// #enddocregion trackByHero
}