title: angular directive scope[attrs.ngModel] is not working
body: <p>if the user input is not a number, i have to revert to old number value. </p>
  
  <p>setting scope value from directive is not working. </p>
  
  <p><a href="http://jsfiddle.net/vfsHX/149/" rel="nofollow">http://jsfiddle.net/vfsHX/149/</a></p>
  
  <pre><code>app.directive('isNumber', function () {
      return {
    require: 'ngModel',
          link: function (scope, element, attrs) {
              scope.$watch(attrs.ngModel, function(newValue,oldValue) {
              var arr = String(newValue).split("");
              if (arr.length === 0) return;
              if (arr.length === 1 &amp;&amp; (arr[0] == '-' || arr[0] === '.' )) return;
              if (arr.length === 2 &amp;&amp; newValue === '-.') return;
              if (isNaN(newValue)) {
                  console.log(oldValue);
                  scope[attrs.ngModel] = oldValue;
              }
          });
      }
  };
  });
  </code></pre>