Reputation: 61
I am trying to create a directive, which will tell me that the field is readonly or not.
myApp.directive('ngFieldLevelPolicies', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
element.bind('input', function () {
scope.$apply(function () {
//debugger;
var fieldPolicies = scope[attrs.ngModel.split('.')[0]].
FieldLevelPolicies;
SetRights(element, attrs.ngModel.split('.')[0],
attrs.ngModel.split('.')[1], fieldPolicies);
});
});
}
};
});
I want this directive to be added as an attribute and called when binding is happeing.
Upvotes: 4
Views: 1824