A component controls a patch of screen called a view.
Component is a class that contains data & logic of application, component is associated with view.
Each component defines a class that contains application data and logic,
and is associated with an HTML template that defines a view to be displayed in a target environment.
CUSTOM VIEW COMPONENT:
home.html
<common-action [item]="item" (componentFunction)="pageFunction($event)"></common-action>
home.ts
pageFunction(event){
console.log(event)
}
common-action.ts
@Input() item;
@Output() componentFunction = new EventEmitter();
anyFunction(){
this.componentFunction.emit(this.item);
}
common-action.html
{{item.name}}