How to dynamically set read-only field level in angular js

I am trying to create a directive that 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 the binding is happeing.

+4
source share
1 answer

It seems that you are looking for ngReadonly .

+3
source

Source: https://habr.com/ru/post/1497089/


All Articles