@Component({
})
export class App implements OnInit {
}
请问implements OnInit
这两个词是什么东西?
对于implements完全没概念,网上找的教程似乎也没有提及……
OnInit是钩子函数吗?意思在渲染这个组件的时候就执行?
求教,谢谢!
两点:
implements
表示接口实现,这是typescript的东西,所以你搜索的姿势不对【typescript implements】。
OnInit
的确是生命周期钩子,这是Angular的东西,见:https://angular.cn/docs/ts/la...。