title: AngularJs Directive to add Attributes, the events are not triggered
body: <p>Good morning everybody,</p>
  
  <p>I'm a bit stuck on this directive, what I want is to receive a JSON string from the getProperties function like: </p>
  
  <pre><code>{"class":"someclass","ng-change":"someChange()",ng-click": "someCLick()"}
  </code></pre>
  
  <p>The directive will create all the attributes present in the JSON(and it works), the problem is the ng-* doesn't work at all.... any ideas??</p>
  
  <p>HTML:</p>
  
  <pre><code> &lt;div ng-repeat="field in fields"&gt;
      &lt;input  type="text" ng-model="ngModel[field.fieldName]" ng-switch="text" property="{{formParams.getProperties(field.fieldName)}}" update-attr /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the directive:</p>
  
  <pre><code> .directive('updateAttr', function () {
          return {
              restrict: 'A',
              replace: true,
              scope:{
                  test:'&amp;'
              },
              terminate:true,
  
              link: function (scope, elem, attrs) {
                  if (angular.isDefined(attrs['property']) || attrs['property'].lenght != 0) {
                      var json = JSON.parse(attrs['property']);
                      elem.removeAttr('property');
                      angular.forEach(json, function (value, key) {
                              elem.attr(key, value);
                      });
                  }
              },
          };
      })
  </code></pre>
  
  <p>here's a jsFiddle: <a href="http://jsfiddle.net/nyyfmd0e/16/" rel="nofollow">http://jsfiddle.net/nyyfmd0e/16/</a></p>