The most straightforward way to set up an Angular project is to use the official Angular CLI tool. The CLI tool interactively generates an Angular app that works out of the box.
If you don't have the Angular CLI installed globally, use the following command to install it:
npm i -g @angular/cli
Once the installation is complete, run the following command in your terminal to create a new Angular app:
ng new my-new-app
Once you run the command, the Angular CLI presents the following options:
- Adding Angular Routing to the project.
- The Stylesheet format to add to the project:
For the first option, if you choose
Yes, the CLI tool adds routing automatically to the project. Then, you can select your preferred stylesheet format for the second option. Once selected, Angular CLI provides the selected stylesheet format for the project.
After a successful scaffolding,
my-new-app directory and run the following command to serve your app in the browser:
ng serve --open
Your browser will automatically be launched with the served Angular app at http://localhost:4200/
With your Angular app set up, it is ready to deploy live with Now.
If you have not yet installed Now, you can do so by installing Now CLI.
With Now installed, you can deploy your Angular project with a single command.
When your app is deployed, you will receive a deployment URL similar to the one shown at the beginning of this guide: https://tour-of-heroes-he3j9k80n.now.sh/