Ishmeet Singh
Ishmeet Singh

Reputation: 139

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

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 ?

Upvotes: 0

Views: 260

Answers (1)

Kristof Czimer
Kristof Czimer

Reputation: 41

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

Upvotes: 0

Related Questions