Angular在将脚本引用为ES6模块时找不到模块

Angular unable to find module when referencing script as ES6 module

本文关键字:模块 ES6 找不到 引用 脚本 Angular      更新时间:2023-09-26

这里有一个简单的plunk。我所要做的就是通过将script标记的type属性设置为module,将app.js文件引用为ES6模块。如果我添加类型,那么Angular似乎找不到模块。如果我把它拿出来,它就会找到它。我做错了什么?

我希望我的app.js文件被视为ES6文件的原因是,我可以导入其他ES6模块,这样我就可以创建我的控制器和服务。

我正在使用traceur传输到ES5。

在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://collectivegarbage.wordpress.com/2014/10/17/angularjs-and-es6/