[英]Angular unable to find module when referencing script as ES6 module
I have a simple plunk here . 我这里有个简单的小东西 。 All I am trying to do is reference the app.js
file as an ES6 module by setting the type
attribute of the script tag to module
. 所有我试图做的是参考app.js
文件通过设置一个ES6模块type
script标签的属性module
。 If I add the type then Angular does not seem to find the module. 如果我添加类型,那么Angular似乎找不到该模块。 If I take it out it finds it. 如果我将其取出,它将找到它。 What am I doing wrong? 我究竟做错了什么?
The reason I want my app.js
file to be treated as an ES6 file is so that i can import other ES6 modules so I can create my controllers and services. 我希望将app.js
文件视为ES6文件的原因是,我可以导入其他ES6模块,以便创建控制器和服务。
I am using traceur
for transpiling to ES5. 我正在使用traceur
移植到ES5。
Figured it out with the help of the guys at Traceur: 在Traceur的帮助下弄清楚了:
<script>
System.import("app").then(function(a){
angular.element(document).ready(function() {
angular.bootstrap(document, ['plunker']);
});
});
</script>
http://plnkr.co/edit/dzc0iPGAs6khvJOe0Ema?p=info http://plnkr.co/edit/dzc0iPGAs6khvJOe0Ema?p=info
Blogged what I found over here: http://collectivegarbage.wordpress.com/2014/10/17/angularjs-and-es6/ 博客记录了我在这里找到的内容: http : //collectivegarbage.wordpress.com/2014/10/17/angularjs-and-es6/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.