Write the CLI command to generate a component in Angular4.

Sharad Jaiswal
Sharad Jaiswal

Posted On: Feb 22, 2018

 

Components are just simple classes which are declared as components with the help of component decorators.
It becomes easy to create an application which already works, with the help of angular CLI commands. “Ng generate” is used to generate components, routes, services, and pipes. Simple test shells are also created with the help of this CLI command. For generating a component in angular4 with the help of CLI command, you need to follow the following syntax-

  • ng generate component component_name;

It generates the component and adds the component to module declarations.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Angular 4 Interview Questions

    Explain component decorators in Angular4.

    A decorator is the core concept when developing an angular framework with version 2 and above. It may become a core lang..

    Angular 4 Interview Questions

    Explain the component directory structure of angular4.

    Here are the elements which are present in the component directory structure anf modules:-module.ts- in this, the angu..

    Angular 4 Interview Questions

    Explain ngFor directive with an example.

    The ngFor directive instantiates a template for every element of the given iterator. The different local variables of th..