What are hooks in angular?
- When a new component is created in angular, it goes through many phases, each phase has a call back attached to it.
- The callbacks are called in Following order
- Constructor
- ngOnChanges()
- ngOnInit()
- ngOnDoCheck()
- ngAfterContentInit()
What is a service in angular?
- A Service is used by multiple components
- It helps to avoid duplication of code, thus avoiding DRY principle(Do not repeat yourself).
- Separate component Presentation, logic from business logic.