How to display the message using ng-show when the input field is not changed?

255 Views Asked by At

Hy I have an input inside the form named relationshipForm.

<input id="change_R_text" type="text" class="form-control" 
                               ng-model="formData.parameters.otherRelationshipText"
                               ng-pattern="/^[a-zA-Z. ]+$/"
                               ng-required="true" name="otherRelationshipText" maxlength="100">

I want to display a message if the content in the input is not changed

I am using this to display messages for required validation

                            <span style="color:red" ng-show="relationshipForm.$sumbitted && relationshipForm.otherRelationshipText.$error.required">  field cannot be empty </span>

Now I want to display message if the user tries to update the input box without changing anything using the same span structure...This is the message "You cant update the same selected field"... .How can I modify the below span ?

<span style="color:red" ng-show="relationshipForm.$sumbitted && _________   ">  you cant update the same selected field </span>

How can I update my ng-show condition ?

1

There are 1 best solutions below

1
Kristof Czimer On

have you tried it with the ng-change directive? https://www.w3schools.com/angular/ng_ng-change.asp