I have encountered a console error while trying to utilize ngClass within my directive. The specific error message reads:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
To demonstrate this issue, here is a simplified version of the directive causing the problem:
angular.module('myApp', [])
.directive('myDirective', function () {
return {
restrict: 'E',
scope: {
myNgClass: '='
},
template: '<div ng-class="myNgClass">Hello World</div>'
}
});
Furthermore, I am implementing the directive in the following manner:
<my-directive my-ng-class="{'green':true}"></my-directive>
You can also access a related jsFiddle link.