4 ms·
It isn't clear to me if with Angular2 you're "forced" to use Typescript. All the examples I see use it. Haven't found a full thing using es5 or es6.
by user1241320 11y ago
It isn't clear to me if with Angular2 you're "forced" to use Typescript. All the examples I see use it. Haven't found a full thing using es5 or es6.
- davej 11y agoTypescript compiles down to ES5, so yes you can write in ES5 but it's not as pretty. You can create a class the standard way using `prototype` and from memory the annotations look something like this: MyComponent.annotations = [ new angular.Component({ selector: 'my-component' }), new angular.View({ template: '<div></div>' }) ];
- highpixels 11y agoThey recently announced a "cleaner" syntax for ES5 mode. Looks more like the Angular 1 syntax. http://blog.thoughtram.io/angular/2015/07/06/even-better-es5-code-for-angular-2.html http://blog.thoughtram.io/angular/2015/07/06/even-better-es5...
- keedot 11y agoNo, you don't have to use TypeScript, the angular dev team has been clear on this. You don't have to use atscript either. That said, typescript is pretty slick, and is essentially ES6+, I'd recommend giving it a shot before dismissing it.
- user1241320 11y agoGreat. As far as I know there's no atscript anymore. So that's clear. But again browsing around https://angular.io/ https://angular.io/ one would read TS all over the place and, surprisingly, es6 is barely ever mentioned. edit I'm not dismissing TypeScript (in fact I love types being also a Scala dev)... I was just surprised Angular2 skips es6 altogether. That's it.
- ShMcK 11y agoActually, the ES6 and TypeScript versions are virtually indistinguishable, so it's not worth posting both on the site. The only difference being the types/interfaces are dropped in ES6.