COMPONENT : Angular component definition, create custom component, create dynamic component

yotube
0

 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}}





Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top