Efficient-angular
GitHubToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

CLI

Angular CLI : Useful commands

Create a feature module:

Execute the command:

ng generate module {module-name}

Shorter command:

ng g m {module-name}

For example, you can create an AuthenticationModule like this:

ng generate module authentication

To automatically create a routing module with your new module, you can add --routing=true:

ng g m {module-name} --routing=true

Create a component

Execute the command:

ng generate component {module-directory-name}/{component-name}

Shorter command:

ng g c {module-directory-name}/{component-name}

For example, you can create a LoginComponent like this:

ng g c authentication/login

Create a service

Execute the command:

ng generate service {module-directory-name}/services/{service-name}

Shorter command:

ng g s {module-directory-name}/services/{service-name}

For example, you can create an AuthenticationService like this:

ng g s authentication/services/authentication