Angular 2 + Typescript Or Angular 2 + Javascript Which One Is Advisable
Solution 1:
The main differences between ES6 and TypeScript in the context of Angular2 applications are the following:
You can't use types for class properties, variables and method parameters.
Decorators for method parameters aren't supported. For example for dependency injection, you need to specify a static setter for the "parameters" property:
constructor(http) { this.http = http; } staticgetproperties() { return [[ Http ]]; }
With TypeScript, you will have this:
constructor(private http:Http) { }
So both are usable in Angular2. The framework promotes more TypeScript in docs but Ionic2 (that uses Angular2) uses by default ES6 in the application created using "ionic start". So you're free to use one or the other.
The main advantage of TypeScript is its "strong typing" feature that allows you to ensure that the right structures are provided / returned and you don't use something that isn't present on objects.
Another cool thing is the support of IDEs for autocompletion when developping TypeScript applications.
Solution 2:
- Angular2 is written in Typescript and the team recommends to use it with Typescript.
- Here on stackoverflow over 90% of questions/answers are submitted in Typescript.
- At this moment angular2 docs has a better support in typescript (this may change until the official release)
So yeah, I think that Angular2 will be more popular in Typescript than ES6/ES5/Dart, I will definitely advise to use it with Typescript.
Solution 3:
Based on my experience, I'd recommend you learn Angular + JavaScript ES6
, because Angular 2
is still under beta. A lot of things will change during your learning so you'll have to learn same things over and over. Documentation or tutorials will be also obsolete.
Post a Comment for "Angular 2 + Typescript Or Angular 2 + Javascript Which One Is Advisable"