使用没有TypeScript Transpiler的Angular 2 [英] Using Angular 2 without TypeScript Transpiler
问题描述
我想学习Angular 2并将我的应用切换到使用它,但是,我在使用TypeScript时遇到了问题。
I want to learn Angular 2 and switch my app to using it, however, I'm having a problem with using TypeScript.
在我目前的环境中,我不能使用transpiler / compiler。我目前只需要运行node.js可执行文件(node.exe),但不是完整的node.js应用程序,也不是npm。 Angular 2是用TypeScript编写的,因此需要在发送到浏览器之前将其编译为JavaScript。
In my current environment I can't use a use the transpiler / compiler. I'm currently having to run off of just the node.js executable (node.exe) but not the full node.js application, nor npm. Angular 2 is written in TypeScript, so it needs to be compiled to JavaScript before being sent to the browser.
有没有办法获得Angular 2的预编译版本,所以我可以用JavaScript编写并在没有编译器的情况下运行?
Is there a way to get a pre-compiled version of Angular 2 so I can write in JavaScript and run without a compiler?
如果没有,有没有办法只用node.exe可执行文件手动安装和使用TypeScript编译器?
If not, is there any way to manually install and use the TypeScript compiler with just the node.exe executable?
要明确,这不是因为我不想使用TypeScript,而是因为在我目前的情况下我无法安装它。
To be clear, this isn't because I don't want to use TypeScript, but rather because in my current situation I can't install it.
推荐答案
Angular2适用于TypeScript,JavaScript和Dart。无需使用TypeScript。
Angular2 is available in TypeScript, JavaScript and Dart. No need to use TypeScript.
请参阅
- https://angular.io/docs/js/latest/index.html
- http://blog.thoughtram.io/angular/2015/05/09/writing-angular-2-code -in-es5.html
- http://blog.thoughtram.io/angular/2015/07/06/even-better-es5-code-for-angular-2.html
另请参阅是否可以将ES5 JavaScript与Angular 2而不是TypeScript一起使用?
<script src="https://code.angularjs.org/2.0.0-beta.3/Rx.umd.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.3/angular2-polyfills.js"></script>
<script src="https://code.angularjs.org/2.0.0-beta.3/angular2-all.umd.dev.js"></script>
这篇关于使用没有TypeScript Transpiler的Angular 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!