index.js
这是我的切入点
import * as stylesheet from '../assets/styles/app.scss';
import jQuery from '../node_modules/jquery/dist/jquery';
import $ from '../node_modules/jquery/dist/jquery';
import {bootstrap} from './boot'
import {AppComponent} from './app.component'
bootstrap(AppComponent);
应用程序组件.js
这有效
(function (app) {
app.AppComponent = ng.core
.Component({
selector: 'my-app',
template: '<h1>My First Angular 2 App</h1>'
})
.Class({
constructor: function () {
}
});
})(window.app || (window.app = {}));
Question
我尝试使用来自的答案如何在没有装饰器语法的情况下编写 Angular2? https://stackoverflow.com/a/34356562/802365没有成功。
未经测试!
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: `
<h1>
My First Angular 2 App
</h1>
`
})
export class AppComponent {
constructor () {
}
}
也许您因为认为您需要app
多变的?
只是为了明确你不需要参考app
,你只需要导入AppComponent
(正如你已经拥有的那样)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)