Angular 4 component lifecycle

前端 未结 1 478
猫巷女王i
猫巷女王i 2020-12-16 06:51

I am trying to use the component life cycle hooks that are exposed by Angular 4 to process certain information related to the component.
When I tried to search I was abl

相关标签:
1条回答
  • 2020-12-16 07:37

    In Angular all lifecycle hooks are triggered as part of change detection by the framework. To learn more about the process read:

    • Everything you need to know about change detection in Angular
    • These 5 articles will make you an Angular Change Detection expert

    For example in Java following lines of code would trigger the constructor in 'String' class:

    Constructor is not a lifecycle hook and is triggered when a component is created. It's similar mechanics to the one you showed which includes calling a component constructor with new.

    To learn more read:

    • The essential difference between Constructor and ngOnInit in Angular
    0 讨论(0)
提交回复
热议问题