AngularJS 2 - Which language to use? (Typescript, Javascript, Dart) [closed] AngularJS 2 - Which language to use? (Typescript, Javascript, Dart) [closed] dart dart

AngularJS 2 - Which language to use? (Typescript, Javascript, Dart) [closed]


Dart makes it easy to start because everything you need is provided by the Darts ecosystem out of one hand (language, package management, build, ...).

TypeScript

For TS there are the most resources available (documentation, ...) because there is a huge user base.

The Dart and JS version of Angular is generated from TS.
There seem to be lots of issues to get a Angular+TS project up and running (see Angular2 questions here on SO) but there are seed projects available where everything is set up already. I don't know details because I'm using only Dart myself.

For TS there is now Angular CLI which improves the developer experience a lot for Angular2 with TypeScript.

JavaScript, ES5, ES6

If you're a JS purist, it might be the right language for you. If not (if you were you probably wouldn't ask this question) then I'm quite sure you're better off using Dart or TS. Angular makes use of type annotations in several ways. With JS there are "workarounds" needed, where otherwise a simple type annotation is enough (mostly dependency injection).

Dart

Dart is a nice language with a set of tools that work well together.A lot of issues the JS/TS environment causes are solved elegantly for Dart.

Since about 2016/05 Angular2 Dart is an independent project and differs quite a lot from the TS and JS versions (as of 2016/10).

  • The Router module that was replaced in TS several times to make it work with offline template compilation, wasn't replaced in Dart because in Dart lazy loading also works fine with the "old" router.

  • ... and also NgModule wasn't introduced to Dart for the same reason.

  • The new Forms module built for TS wasn't ported (yet) to Dart.

  • Dart had offline template compilation from the beginning but doesn't support the browser-platform-dynamic to compile components at runtime.

  • A new Dependency Injection module seems to be work in progress for Dart based on Dagger2 (currently not yet available) to replace the DI system that was auto-generated from TypeScript code.

  • Angular2 Dart has a strong focus on build output size and runtime performance but AFAIK support for multi-platform support (like server-side rendering) was dropped.