angular removes ng-model variable if ng-required is true


as in the title.. how to prevent such operations to happen? Here is a link to the official site, see the example. The variable is bound to the first input userName and if the input is empty the object is removed. How can I disable this functionality of angularjs?


Try ng-model-options="{allowInvalid: true}" to update the model even for invalid entries.

<input ng-model="" required ng-model-options="{allowInvalid: true}">

Answered By – Vinay K

Answer Checked By – Marie Seifert (AngularFixing Admin)

Leave a Reply

Your email address will not be published.