Differences between Angular.js and Angular.dart?

I know a little about Angular.js, but I want to teach myself Dart and Angular.dart now. I'm a little curious about the differences between the two. The Angular.dart tutorial specifically says that it will not compare the two . Anyone who used both have an idea of ​​the differences?

+61
angularjs dart angular-dart
Nov 15 '13 at 4:09
source share
3 answers

Update # 2 (Aug '16) Dant version of Angular is now supported by the Dart team on Github: dart / angular2 on github

Update : AngularDart project is mothballed and replaced with Angular2. Angular2 is the latest iteration of Angular and works in Dart.

The original answer below compares AngularDart and AngularJS 1.x.

AngularDart and AngularJS are supported by the Angular team. We took a lot of knowledge from JS and applied it to Dart. We also took a lot of code and put it right in the world of Darts.

At a technical level, in the Angular core:

  • The expression language is compatible between the two versions. The AngularDart parser started as a direct port from JS, but developed on its own. The big difference is that the Dart parser supports several backends, including the Dart code generator.

  • DI system is different. In Dart, it is based on a class, where in Javascript it is based on a symbol.

  • The compiler is completely rewritten in the Dart version. This means that directives behave differently, and now there is a difference between “structural directives” that modify the DOM, “decorative directives” and components.

  • ng-transclude "melted in the browser", replaced by the standard shadow DOM.

  • control controllers were combined into components

    Directives
  • in AngularDart are declared with an annotated class. link / compile functions are replaced by apply function

  • In AngularDart, an area is calculated automatically through Dart areas, eliminating the need for the area. $ apply.

  • AngularDart has the concept of attribute maps that have not yet returned to AngularJS. This means that directives should require much less features. $ Watches or even area dependency.

There may be other differences, but this is a good list to get you started.

+91
Dec 10 '13 at 20:50
source share

So, the first difference is pretty obvious: AngularJS is written in JavaScript, while Angular.dart written in the dart.

While Angular.dart follows the basic principles of AngularJS , this seems like a bit of a playground for developing new features. I think the core team takes all the knowledge from AngularJS and tries to implement things a little better for the version of Angular.dart . Currently, it seems like a bunch of things are first implemented in the dart version of Angular before they get back to AngularJS . For example, they simply added a lighter version of ng-repeat , which should eventually end in AngularJS .

Also, the Angular team recently talked about what is planned for Angular 2.0. I bet most of these things will first land in Angular.dart before they land in AngularJS .

+16
Dec 07
source share

Update 08/2016

Angular 2 for JS and Dart are now independent projects and will somewhat diverge.

For example, the NgModule introduced in TS RC.5 will probably not be placed in Dart, and the router module will probably not be translated directly. These are the changes that TS needed for lazy loading. Dart has an easier boot history and does not need many of the changes made to Angular2 for TS.

Update

There are (almost) no differences with Angular 2, because Angular.dart and Angular.js are automatically generated from the same TypeScript source. http://techcrunch.com/2015/03/05/microsoft-and-google-collaborate-on-typescript-hell-has-not-frozen-over-yet/

Original

  • Analog ngTransclude in Angular.Dart
    Angular.dart uses shadowDom, but AngularJs does not.
    AngularJs uses ngTransclude instead.

  • What is the difference between ng-app and data-ng-app?
    Angular.dart does not seem to support other prefixes, as discussed in a related question.

  • Angular.dart does not have the equivalent of ng-init . (see also GitHub Problem - Port: ng-init )

  • Angular.dart does not have the ng-controller directive ( port: ngController )
    instead, @NgController(selector:'[foo-controller]', publishAs:'foo')

  • Angular.dart does not support ng-repeat with maps ( ng-repeat with a broken Map )

  • Angular.dart has no restrict Has an Angular.dart directive equivalent to `AngularJS` constraints

  • Misko Hevery, creator of AngularJS and member of the AngularDart team, answered a similar question here

This article lists some of the differences: ANGULARDART FOR ANGULARJS DEVELOPERS. INTRODUCTION TO THE BEST Angular YET.

+13
Dec 08 '13 at 11:01
source share



All Articles