angular-docs-cn/public/docs/_examples/cb-ts-to-js/js-es6/app/hero-lifecycle.component.es6

16 lines
323 B
JavaScript

// #docregion
import { Component } from '@angular/core';
export class HeroComponent {
ngOnInit() {
// todo: fetch from server async
setTimeout(() => this.name = 'Windstorm', 0);
}
}
HeroComponent.annotations = [
new Component({
selector: 'hero-lifecycle',
template: `<h1>Hero: {{name}}</h1>`
})
];