Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i condition ng-readonly inside textarea

Tags:

angularjs

I'm looking for a way to condition a ng-readonly inside an ng-if statement.. i tried it in a few way, this is my latest vesion..

ng-if="note.owner_image === user.image "  ng-readonly="false"

need some assistant..

<textarea 
                  class="wm-textarea-notes"
                  ng-model="noteEdit.note_value" 
                  columns="1"  
                  placeholder="Add a note"
                  ng-readonly="true"
              ng-if="note.owner_image === user.image "  ng-readonly="false"
              ng-if="note.owner_image === "" "  ng-readonly="false


                  ></textarea> 
like image 429
omer Avatar asked Jul 06 '15 12:07

omer


Video Answer


1 Answers

ng-if is used to hide or show the element based on the condition given. if you want the condition to apply to ng-readonly, you should put it in the ng-readonly attribute:

<textarea 
    class="wm-textarea-notes"
    ng-model="noteEdit.note_value" 
    columns="1"  
    placeholder="Add a note"
    ng-readonly="note.owner_image !== user.image || note.owner_image !== ''">
</textarea> 
like image 137
Victor Richa Avatar answered Sep 27 '22 21:09

Victor Richa