Sunday 12 July 2020

Angular - Example 3 - Create New Component and Call Component Content in App Component

1. Create New Project Using Following Cmd - ng new NewComponent - NewComponent as Project Name

2. Open Visual Studio Code Application and open project.

3. Generate new component using cmd - 'ng g c Master\CustomerMaster'
   g - generate 
   c - Component 
   Master - New Folder Name
   CustomerMaster - new Component Name


4. 4 new files are created for new component - .html, .spec.ts, .ts, .css



5. After Creating New Component automatically changed in 'app.module.ts' file.


6. Open the file 'customer-master.component.html' and changed code to <p>customer-master works!</p>



7. Selector name get from 'customer-master.component.ts' file and include into with tag in 'app.component.html' file.




8. And to complie and run this project -- ng serve --o


OUTPUT


No comments:

Post a Comment