【发布时间】:2016-04-06 10:55:50
【问题描述】:
我正在尝试将 angular2 集成到我的 PHP 应用程序中。 这是我执行的步骤
- 包含必要的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
- 在 Typescript 中创建了 angular2 组件:
import {Component} from 'angular2/core';
@Component({
selector: 'hello-world',
template: 'My First Angular 2 App'
})
export class AppComponent { }
- 配置:
<script>
System.config({
transpiler: 'typescript',
typescriptOptions: { emitDecoratorMetadata: true }
});
</script>
- 引导程序:
<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>
编辑:
好像prototype.js和angular 2有冲突,看pluker:http://plnkr.co/edit/XKKpriTPrTX3tXqqz8v2?p=preview
【问题讨论】:
标签: javascript ecmascript-6 angular angular2-services