Angular.ts.js.at.dart.wtf
You might have heard that Angular is going to be using TypeScript.
This has lead to questions about the relationship between Angular and Dart.
Let me see if I can help.
First, Angular 1.
Angular 1 JS is crazy popular. Mountains of folks use it. It’s awesome.
Angular 1 Dart was a hand-rolled port of Angular 1 JS. It tried to follow the JS flavor of the framework, while being a true Dart framework. While a lot of folks have used Angular 1 Dart, especially within Google, it turned out to be tough to maintain two separate versions of the same framework for two languages.
Enter Angular 2.
Angular 2 was pitched in October as a better/faster framework built on AtScript – AtScript was an extension of TypeScript from the beginning.
Important point: Angular 2 has always been built on TypeScript.
The Angular/TypeScript announcement is amazing news. The features that were added to AtScript are being pulled into TypeScript.
Important point: AtScript has been merged into TypeScript – one less language to worry about.
TypeScript lets the Angular folks build a framework that targets both Javascript and Dart simultaneously. Check out the Angular Travis page to see build output for both languages.
Important point: Angular 2 has first class support for Javascript AND Dart out of the box.
This leaves us with THE BIG QUESTION:
Why isn’t Angualr 2 just built in Dart?
Answer: the Angular folks want to deliver a great framework for BOTH Javascript and Dart.
Dart generates great Javascript for browsers, but we have work to do to generate reusable Javascript libraries.
The Angular team needs to generate reusable Javascript libraries.
That’s it.
One of my personal goals is to make Dart great for generating JS libraries. We’ll have more to discuss at the Dart summit in April – psst – you should register.
In the mean time, check out the alpha of Angular2 Dart package.
Check out the Angular GitHub project if you want to play with Angular for Dart or Javascript – OR BOTH.
File bugs. File feature requests. Send pull requests.
I’ve had fun using the Dart analyzer to do a bunch of cleanup in the Angular source – it’s nice.
Happy hacking – now with 20% less FUD.