Using Angular 2 without TypeScript Transpiler

后端 未结 2 579
醉酒成梦
醉酒成梦 2020-12-29 08:37

I want to learn Angular 2 and switch my app to using it, however, I\'m having a problem with using TypeScript.

In my current environment I can\'t use a use the tran

2条回答
  •  萌比男神i
    2020-12-29 09:25

    If you want to use TypeScript to write your application, you need a transpiler:

    • static. For example with a tsc -w command running in background
    • on the fly. Directly within the browser using the typescript.js file

    That said it's possible to write Angular2 applications with ES5 only. Here is a sample:

    • http://blog.thoughtram.io/angular/2015/07/06/even-better-es5-code-for-angular-2.html

    Edit

    When you include these JavaScript files fro Angular2 (folder node_modules/angular2/bundles), there is nothing about TypeScript:

    
    
    
    
    
    
    

    These files were transpiled into JavaScript. So there is no need to have TypeScript. With them, you can implement your application with ES6 only.

    To use ES5 only, you need to include these ones:

    
    
     
    

提交回复
热议问题