Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
330 views
in Technique[技术] by (71.8m points)

angularjs - 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 ?

question from:https://stackoverflow.com/questions/65843739/how-to-display-the-message-using-ng-show-when-the-input-field-is-not-changed

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...