Sunday, 3 November 2019

Describe how a component works in angular?


Let’s create a new component using below CLI Command.
ng g c employee/employeeDetails



See the above structure how component is created. When a new component is created it must register in the app.module.ts file.



Now open the employee-details.component.html file and make some changes in it.


Now check the employee-details.component.ts file where you will get a selector. This selector can be used as a html tag to call this component.


Now open the app.component.html and call the selector as a normal html tag.


Now run the application using below command in command prompt
ng s -o

Below is the output you will see in the browser



No comments:

Post a Comment