Angular: Create a workspace (Serie 1)
Prerequisites
1.1 Node.js
According to the documentation, you need Node.js (>10.9.0) installed on your computer. You can check the Node version with the following command:
node -v
.1.2 npm
We use the npm client command line shipped with Node.js to download and install npm packages.1.3 Angular CLI
Use the following command to install the Angular CLI globally:
npm install -g @angular/cli
You can find the available command reference here.
Create a workspace and initial app
In order to create a skeleton for an application named my-app, you only need to run the new command as:
ng new my-app
The new command prompts you to select the routing mode, the style mode (css, scss...).
The
Create a workspace under an existing folder
For creating a workspace under an existing folder, do the following:
- open a terminal on your current folder (e.g. my-app)
- Run the following command :
ng new my-app --directory=./
Run your app
In order to build and serve your app locally, Angular CLI is shipped with a development server.
Run the following command to open your app:
Run the following command to open your app:
cd my-app
ng serve --open
The
--open
option indicates to open the app in your default browser.
Comments
Post a Comment