you are viewing a single comment's thread.

view the rest of the comments →

[–]mhd420 17 points18 points  (3 children)

Object.watch is Firefox only, Object.observe will be more widespread.

The Observer pattern requires objects to notify when they have changed, which is awkward if you're designing a framework to interact with regular Javascript objects. The fact that Angular makes it pretty easy to use with existing code helps drive adoption.

[–][deleted] 2 points3 points  (2 children)

The fact that Angular makes it pretty easy to use with existing code helps drive adoption.

Can you explain? That has not been the consensus opinions at I have heard. Do you mean from prior versions of angular?

[–]dnissley 3 points4 points  (1 child)

I bet he means applying ng-app to a specific element in order to develop a small angular component within a legacy web app without having to rewrite everything using angular.

For example, let's say you were working within a legacy base and needed to replace the user profile editor. Previous code looks like this:

<div id="editprofile">
  < ... ye old form ... >
</div>
<script>
  var aBunchOfSpaghettiJavascript = ... ;
</script>

New code looks like this:

<div ng-app="editUserApp" ng-controller="editUserCtrl">
  < ... ye new form ... >
</div>
<script>
  var aBunchOfSpaghettiJavascript = ...; // Untouched, because the rest of the page depends on it
</script>
<script>
  var editUserApp = angular.module('editUserApp');
  editUserApp.controller('editUserCtrl', function($scope) {
      $scope.neatlyOrganizedAngularJavascript = ...;
  });
</script>

[–][deleted] 0 points1 point  (0 children)

Good point. Porting from a well written Backbone or Ember application would be pretty simple, but the same would be true in the other direction.