Setup a new Angular (2/4) project

Install Node Package Manager (latest version available, currently 7.7.1 for me) if you don’t already have it.

(You can find more info about Angular’s CLI at https://cli.angular.io)

Next  you will use need to install the Angular CLI as follows:

npm install -g @angular/cli

Navigate into the folder where you want to create your new project using terminal (mac) or command window (windows).

To create your project type:

 ng new my-new-app

To navigate into your folder, type:

 cd my-new-app

To run your app in a browser, type:

 ng serve

Let’s say you want to go ahead and get Bootstrap into your project, use your CLI again. Make sure you are currently still in your project folder and type:

Add Bootstrap to your Angular project

npm install --save bootstrap

In your Dev Environment, find the Angular-cli.json file and open it. We need to add Bootstrap to that. find the “apps/styles” property
Change it from:

"styles": [
"styles.css"
]

to

"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"styles.css"
]

Now your project is ready to use Bootstrap.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s