Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
300 views
in Technique[技术] by (71.8m points)

关于Angular的implements

@Component({

})
export class App implements OnInit {

}

请问implements OnInit这两个词是什么东西?

对于implements完全没概念,网上找的教程似乎也没有提及……

OnInit是钩子函数吗?意思在渲染这个组件的时候就执行?

求教,谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

两点:

  1. implements 表示接口实现,这是typescript的东西,所以你搜索的姿势不对【typescript implements】。

  2. OnInit 的确是生命周期钩子,这是Angular的东西,见:https://angular.cn/docs/ts/la...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...