简体   繁体   中英

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 . If I add the type then Angular does not seem to find the module. 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.

I am using traceur for transpiling to ES5.

Figured it out with the help of the guys at 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

Blogged what I found over here: http://collectivegarbage.wordpress.com/2014/10/17/angularjs-and-es6/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM