title: angularjs - Getting the binding expression from an attribute (not the resolved value)
body: <p>I'm making a directive that cross fades between images based on this: <a href="http://www.bennadel.com/blog/2497-Cross-Fading-Images-With-AngularJS.htm" rel="nofollow">http://www.bennadel.com/blog/2497-Cross-Fading-Images-With-AngularJS.htm</a></p>
  
  <p>Instead of watching a particular field, i'd like to watch whatever the image is binding to in ngSrc. So rather than (coffeescript):</p>
  
  <pre><code> $scope.$watch "data.ActiveImage", (newValue, oldValue) -&gt;
  </code></pre>
  
  <p>I'd like to use:</p>
  
  <pre><code> $scope.$watch attributes['ngSrc'], (newValue, oldValue) -&gt;
  </code></pre>
  
  <p>Where the DOM element looks like:</p>
  
  <pre><code>&lt;img cross-fade-on-change ng-src="{{data.ActiveImage}}"/&gt;
  </code></pre>
  
  <p>The problem is, the watch expression is resolving to the bound url, rather than the binding expression. How/can I do this?</p>