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 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.
Is there a way to get a pre-compiled version of Angular 2 so I can write in JavaScript and run without a compiler?
If not, is there any way to manually install and use the TypeScript compiler with just the node.exe executable?
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.
Typescript is optional, but strongly recommended.
Angular2 is available in TypeScript, JavaScript and Dart. No need to use TypeScript. See also Is it possible to use ES5 JavaScript with Angular 2 instead of TypeScript? No, it is written in TypeScript.
Yes. Node. js required for Angular 2 or Angular apps.
Angular is an open-source, JavaScript framework written in TypeScript. Google maintains it and provides a standard structure for developers to work within it. Angular makes use of HTML syntax to define the components of your program clearly.
Angular2 is available in TypeScript, JavaScript and Dart. No need to use TypeScript.
See
- 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
See also Is it possible to use ES5 JavaScript with Angular 2 instead of 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>
If you want to use TypeScript to write your application, you need a transpiler:
tsc -w
command running in backgroundThat said it's possible to write Angular2 applications with ES5 only. Here is a sample:
Edit
When you include these JavaScript files fro Angular2 (folder node_modules/angular2/bundles
), there is nothing about TypeScript:
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
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:
<script src="node_modules/angular2/bundles/Rx.umd.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/angular2/bundles/angular2-all.umd.dev.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With