-4

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?
Amit Chigadani
  • 28,482
  • 13
  • 80
  • 98
Jay
  • 397
  • 1
  • 5
  • 16
  • 1
    Docs related to [Lifecycle Hooks](https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html) – Ploppy Apr 07 '17 at 09:39
  • 1
    Docs related to [Component Interaction](https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service) – Ploppy Apr 07 '17 at 09:40
  • If you are new to Angular, there is an official [Learning Angular guide](https://angular.io/docs/ts/latest/guide/learning-angular.html) – Ploppy Apr 07 '17 at 09:43

1 Answers1

1

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

Community
  • 1
  • 1
tschaka1904
  • 1,303
  • 2
  • 17
  • 39
  • ngOnChanges() => Respond when Angular (re)sets data-bound input properties ..... ngDoCheck() => Detect and act upon changes that Angular can't or won't detect on its own. can you please elaborate this as i am confused – Jay Apr 10 '17 at 13:48