1

i know ng-class can add/remove 'classes' based on Angular variables or based on evaluated expressions. But if i want to say put an attribute like 'readonly' on an element based some variable in the controller, what is the simplest method. I wish a directive like 'ng-attr' exists.

1 Answer 1

2

for readonly you can use ngReadonly: https://docs.angularjs.org/api/ng/directive/ngReadonly

for more general solution check ngAttr: https://docs.angularjs.org/guide/interpolation

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.