Angular 5 Components - WebSecuritySpecialist
Hire Us For Secure Web Development and Security

Saturday, 3 March 2018

Angular 5 Components

Angular 5 components reside within the /src/app folder -

What are Components?
Components are the most basic building block of an UI in your Angular App. An Angular application is a tree of Angular components. Angular components are a subset of directives. Unlike directives, components always have a template and only one component can be instantiated per an element in a template.

Creating a New Component
You can create a component using the Angular CLI command -
ng generate component Your-Component-Name
ng g component home
Output -

  create src/app/home/home.component.html
  create src/app/home/home.component.spec.ts
  create src/app/home/home.component.ts
  create src/app/home/home.component.scss
  update src/app/app.module.ts
Finally created a new component named home successfully. Its time to run the app.
ng serve

No comments:

Post a Comment