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
  • 45,213
  • 22
  • 199
  • 169
CodyBugstein
  • 21,984
  • 61
  • 207
  • 363
  • 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