4

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.

1 Answer 1

3

It seems like what you're looking for is ngReadonly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.