To set up Angular 1, perform the following steps:
- First of all, we need to install Angular via npm:
npm install --save angular
- Do not forget to install the other dependencies by running the following command:
npm install
- Next, we need to import Angular into our src/index.js file. At the top of the file, add the following:
import angular from 'angular'
- Now, we need to tell Angular which element to use as a container. With React, we set id="root", and then referenced this element when rendering with ReactDOM. In the Angular world, we will need to set the ng-app attribute on the container element. In the index.html file, find this:
<div id="root"></div>
Now, replace the preceding line with this:
<div ng-app></div> ...