how to use Angular2, systemjs locally WITHOUT node.js/npm?

后端 未结 2 807
清歌不尽
清歌不尽 2021-01-04 13:48

This is the index.html with angular-alpha35:

    
    
        
        
                


        
相关标签:
2条回答
  • 2021-01-04 14:23

    You should include the sfx version of angular 2 like this:

    <script src="https://code.angularjs.org/2.0.0-alpha.32/angular2.sfx.dev.js"></script>
    

    Note that it's a self contained js file you can download locally.

    Check this sample project I made in github:

    https://github.com/alfonso-presa/angular2-es5-sample

    Edit: Check this SO question for more clarification on what sfx means: Difference between angular.dev.js and angular.sfx.dev.js

    0 讨论(0)
  • 2021-01-04 14:28

    Thanks to Arnaud Boeglin's idea of difference in packages' version, I checked with es6-module-loder and by chance this installation works perfectly (so far I didn't find any problem):

        <script src="scripts/traceur-runtime.js"></script>
        <script src="scripts/es6-module-loader.js"></script>
        <script src="scripts/system@0.16.11.js"></script>
        <script src="scripts/bundle35/angular2.dev.js"></script> 
        <script src="scripts/bundle35/router.dev.js"></script>
    

    The es6-module-loader has to be before the systemjs in <head> tag.

    0 讨论(0)
提交回复
热议问题