1

In the ngDraggable project, I found this code in the directive ngDrag.

 attrs.$observe("ngDrag", onEnableChange);
 scope.$watch(attrs.ngDrag, onEnableChange);
 attrs.$observe('ngCenterAnchor', onCenterAnchor);
 scope.$watch(attrs.ngCenterAnchor, onCenterAnchor);

My question is:

Why would you need both the $observe and $watch properties on the same items?

I've tried commenting each group out and it seems to make no difference at all. What is going on here?

John Slegers
  • 41,615
  • 22
  • 193
  • 161
CodyBugstein
  • 19,435
  • 57
  • 179
  • 333
  • http://stackoverflow.com/questions/14876112/difference-between-the-observe-and-watch-methods – Kiran P Nov 26 '14 at 11:36
  • The `$observe`-ers were removed from the plugin: https://github.com/fatlinesofcode/ngDraggable/commit/03ec8f51ebff9afa0ba929f1236c39c714b6439a – musically_ut Nov 26 '14 at 11:38

0 Answers0