我需要做什么我Angular2组件转换为ES6语法? [英] What do I need to convert my Angular2 component to ES6 syntax?
本文介绍了我需要做什么我Angular2组件转换为ES6语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的入口点
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);
app.component.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 = {}));
问题
我试图用回答我怎样写angular2没有修饰语法?没有成功。
- 如何摆脱
IIFE的
,并使用ES6
语法?
- How do I get rid of the
IIFE
and useES6
syntax?
推荐答案
如果您使用的是巴贝尔和使用下列插件:'angular2批注,变换装饰遗','转换级的属性,变换流条带类型
没有必要的语法转换
If you are using Babel and use the following plugins: 'angular2-annotations', 'transform-decorators-legacy', 'transform-class-properties', 'transform-flow-strip-types'
there is no need to convert the syntax.
您还可以检查它在工作示例。
这篇关于我需要做什么我Angular2组件转换为ES6语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文