Redux with Angular 2+
Angular 2+ makes extensive use of TypeScript, a typed superset of JavaScript. We will use the Angular 2+ command-line tool—ng (@angular/cli)—to create a new project, then copy over the Redux elements we already implemented earlier in the second chapter (chapter2_4.zip). After setting up a basic Angular 2+ application and copying the Redux application, we will combine them using @angular-redux/store to connect Redux with Angular 2+.
Setting up Angular 2+
We are now going to set up an Angular 2+ project:
- First of all, we need to install the Angular 2+ command-line tool—
ngvianpm:
npm install -g @angular/cli- Then, we create a new project with
ng:
ng new chapter44The preceding command will create a new directory, set up TypeScript, and install all dependencies via npm.
- You can now go to the directory (
cd chapter44) and launch the server:
ng serve --openNote
The --open flag means that the ng tool will try to open a browser window automatically. Feel free to omit the flag and open...