Angular2:装饰器之间的区别

时间:2017-04-07 09:37:06

标签: angular

我是Angular2的新手,并希望清除一些概念,因为我提到了很多其他帖子,但仍然不清楚。问题是我无法理解教程中使用的高级语言,所以任何人都可以用简单的语言帮助我理解。

  1. @Input@Output@ViewChild之间的区别是什么。我们可以使用@Output访问子数据,因此@Viewchild@Output
  2. 不同
  3. 什么是@viewContent?任何例子
  4. 他们以任何方式访问来自孩子的父内容,就像我们使用@ViewChild访问子内容一样
  5. ngOnChanges, ngOnInit, ngDoCheck & ngOnDestroy
  6. 我对“初始化component/directive
  7. 这个词感到困惑
  8. ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit & ngAfterViewChecked?

1 个答案:

答案 0 :(得分:1)

  

@ Input,@ output和@ViewChild有什么区别。我们可以   使用@output访问子数据因此使@viewchild不同   @Output

http://learnangular2.com/inputs/ http://learnangular2.com/outputs/ http://learnangular2.com/viewChild/

  

什么是@viewContent?任何例子   我没有听说过@viewContent

     

他们是否可以像我们一样使用来自孩子的父内容   @ViewChild访问子内容

您可以使用服务或使用@Input向下传递数据更多信息: https://angular.io/docs/ts/latest/cookbook/component-communication.html

  

ngOnChanges,ngOnInit,ngDoCheck& ngOnDestroy

请阅读Angular教程: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html

  

我对“初始化组件/指令”一词感到困惑。

我不确定你的意思,但这里有一个澄清的帖子:

@Directive v/s @Component in angular2

  

ngAfterContentInit,ngAfterContentChecked,ngAfterViewInit&   ngAfterViewChecked?

请阅读Angular教程: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html

相关问题