An Introduction to Angular CLI

An Introduction to Angular CLI

Angular CLI Unlike AngularJS, where it was easy to source one file as a dependency and be up and running, Angular has a slightly more complicated setup. To this extent, the Angular team has created a command-line interface (CLI) tool to make it easier to bootstrap and develop your Angular applications. 

Understanding the Angular CLI 

While we have just created our first Angular application, the Angular CLI does a bit more than just the initial skeleton creation.

 It is useful throughout the development process for a variety of tasks, including: 

• Bootstrapping your application

 • Serving the application 

• Running the tests (both unit and end-to-end) 

• Creating a build for distribution 

• Generating new components, services, routes and more for your application. 

Each of these corresponds to one or more Angular CLI commands, and we will cover each one as and when we need or encounter them, instead of trying to cover each command and its uses upfront.

Each command provides further flexibility with a variety of arguments and options, making the Angular CLI truly diverse and capable of a wide variety of uses.

As it significantly helps to make the process of development easier, I recommend using it at the very least for your initial projects until you get the hang of all the things it does and is comfortable doing it yourself.

We will cover both the CLI command as well as the actions it performs underneath so that you get a good understanding of all the changes needed. 

Installing the latest version is as simple as running the following command:

npm install -g @angular/cli

Once installed, you can confirm if it was successful by running the following command:

ng --version

Getting the Codebase

 All the examples from this book, along with the exercises and the final solution, are hosted as a Git repository. While it is not mandatory to download this, you can choose to do so if you want a reference or want to play around with the samples in this book. You can do so by cloning the Git repository by running the following command:

git clone https://github.com/shyamseshadri/angular-up-and-running.git 

This will create a folder called angular-up-and-running in your current working directory with all the necessary examples. Within this directory, you’ll find subfolders containing the examples, organized by chapter.

 Conclusion 

At this point, we are all set up with our development environment and are ready to start developing Angular applications. We have installed Node.js, TypeScript, as well as the Angular CLI and understand the need and use of each. 


Last updated:1/24/2020 5:47:29 AM
ruhhana ali

ruhhana ali

She currently working form onlineitguru.com is a global training company that provides e-learning and professional certification training.

0 Comments

Leave Comment