Generate Class, Interface and Enumerations using Angular CLI

  • Class

Run the below command to generate Class

ng generate class {class-name}

or

ng g cl {class-name}
  • Interface

Run the following command to generate Interface

ng generate interface {interface-name}

or

ng g i {interface-name}
  • Enumeration

Run the below command to generate the Enum in project directory

ng generate enum {enum-name}

or

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s