Tutorial by Examples

NOTE: for best results, make sure your project was created using the Angular-CLI. npm install angular/{core,common,compiler,platform-browser,platform-browser-dynamic,http,router,forms,compiler-cli,tsc-wrapped,platform-server} You don't have to do this step if you project already has angular 2 an...
... "angularCompilerOptions": { "genDir": "./ngfactory" } ... This is the output folder of the compiler.
from the root of your project ./node_modules/.bin/ngc -p src where src is where all your angular 2 code lives. This will generate a folder called ngfactory where all your compiled code will live. "node_modules/.bin/ngc" -p src for windows
// this is the static platform browser, the usual counterpart is @angular/platform-browser-dynamic. import { platformBrowser } from '@angular/platform-browser'; // this is generated by the angular compiler import { AppModuleNgFactory } from './ngfactory/app/app.module.ngfactory'; // note the...
Q. Why we need compilation? Ans. We need compilation for achieving higher level of efficiency of our Angular applications. Take a look at the following example, // ... compile: function (el, scope) { var dirs = this._getElDirectives(el); var dir; var scopeCreated; dirs.forEach(functi...
The Angular CLI command-line interface has AoT compilation support since beta 17. To build your app with AoT compilation, simply run: ng build --prod --aot

Page 1 of 1