Generate Class, Interface and Enumerations using Angular CLI

  • Class

Run the below command to generate Class

ng generate class {class-name}


ng g cl {class-name}
  • Interface

Run the following command to generate Interface

ng generate interface {interface-name}


ng g i {interface-name}
  • Enumeration

Run the below command to generate the Enum in project directory

ng generate enum {enum-name}


ng g e {enum-name}

The below example shows creating the class, interface and enum. For coding practices, I have created the class and interface in the model folder.

generating class, interface n enum

One comment

Leave a Reply