Component in Angular | by ByteCode Pandit
Components Components are the very basic building block UI element in angular applications. They are directives with a special decorator (@Component) and template. Component decorator allows you to mark a class as an Angular component and provide additional metadata that determines how the component should be processed, instantiated, and used at runtime. Below is an example of a basic component: import { Component } from '@angular/core'; @ Component ({ selector: 'hello-component', templateUrl: './hello-component.html', styleUrls: ['./hello-component.css'] }) class Greet { public name: string = 'Component'; } You can easily use this component anywhere in the application buys just including like this <hello-component></hello-component>. Component Life Cycle hooks Components can control their run-time behaviour by implementing various Life-Cycle hooks. The main life-cycle are following. ngOnChanges: Respond when Angular sets or...