Angular
Fundamentals of Angular Directives - Three Types of Directives in Angular
  •  

Creating Directives using the CLI

Outline

Angular CLI

The Angular command-line interface is a powerful and necessary tool for almost all Angular developers. You can find instructions on downloading and installing the CLI at: cli.angular.io. The CLI enables us to quickly and easily scaffold out new directives containing the necessary template, stylesheet, TypeScript class and unit test.

To get started with a new project using the Angular CLI use the following command:

ng new [application-name]

This will create a new directory containing everything you need to get started. Next, change directory into the new directory via cd [application-name].

Once in the project directory we can use the CLI to generate a new directive using the following command:

ng generate directive [path-to-directives/my-directive]

Don't forget that you can use the --dry-run flag to first see what files will be created and modified. This can be helpful to ensure that the files are generated in the correct directory.

Angular Console

The Angular Console is a well-designed and easy-to-use graphical user-interface for the Angular CLI. You can find the download and more details on the Angular Console at: angularconsole.com. The console is available for Windows, macOS and Linux.

 

I finished! On to the next chapter