Setting up an Angular 2 project

Angular 2 code can be written in JavaScript, TypeScript, or Dart. In case you are writing Angular 2 code in TypeScript or Dart, you will need to transpile the code to JavaScript before serving to the client. We will use JavaScript to write Angular 2 code.

Create a directory named angular2-demo. Then, inside the directory, create the app.js and package.json files. Then, create a directory named public, and inside the directory, create four more directories named html, js, componentTemplates, and componentStyles. Now, create a file named index.html and place it in the html directory.

Then, download angular2-polyfills.js, Rx.umd.js, and angular2-all.umd.js from https://cdnjs.com/libraries/angular.js/ and place them ...

Get JavaScript: Moving to ES2015 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.