Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

angular - Angular2: Difference between Decorators

I am new to Angular2 and want to clear some concepts as i referred many other post but still unclear. Issue is am not able to understand high level languages being used in tutorials so please can anyone help me understand in simple language.

  1. what is difference between @Input, @Output and @ViewChild. we can access child data using @Output so makes @Viewchild different from @Output
  2. what is @viewContent? any example
  3. Is their any way to access parent content from child like we use @ViewChild to access child content
  4. ngOnChanges, ngOnInit, ngDoCheck & ngOnDestroy
  5. I am confused with the term Initializes the component/directive.
  6. ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit & ngAfterViewChecked?
See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

what is difference between @Input, @output and @ViewChild. we can access child data using @output so makes @viewchild different from @Output

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

what is @viewContent? any example I haven't heard of @viewContent

Is their any way to access parent content from child like we use @ViewChild to access child content

You could use a service or pass the data down using the @Input More here: https://angular.io/docs/ts/latest/cookbook/component-communication.html

ngOnChanges, ngOnInit, ngDoCheck & ngOnDestroy

Please read the Angular tutorial: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html

I am confused with the term Initializes the component/directive.

I'm not sure what you mean with that, but here is a post for clarification:

@Directive v/s @Component in angular2

ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit & ngAfterViewChecked?

Please read the Angular tutorial: https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...