I am trying to integrate angular2 in my PHP app. Here are the steps I have performed
- Included necessary JS:
../node_modules/angular2/bundles/angular2-polyfills.js
../node_modules/systemjs/dist/system.src.js
../node_modules/typescript/lib/typescript.js
../node_modules/rxjs/bundles/Rx.js
../node_modules/angular2/bundles/angular2.dev.js
- Created angular2 component in Typescript:
import {Component} from 'angular2/core';
@Component({
selector: 'hello-world',
template: 'My First Angular 2 App'
})
export class AppComponent { }
- Config:
<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true }
});
</script>
- Bootstrap:
<script>
System.import('angular2/platform/browser').then(function(ng){
System.import('js/app.ts').then(function(src) {
ng.bootstrap(src.AppComponent);
}).then(null, console.error.bind(console));
});
</script>
EDIT:
It seems that there is a conflict with prototype.js and angular 2. See the pluker: http://plnkr.co/edit/XKKpriTPrTX3tXqqz8v2?p=preview