Angularjs reset form field with email type

In AngularJs, it seems that when you try to "reset" the form, setting all models to empty objects, if the input type="email"is not cleared. However, changing it to type="text"work, but then you lose the red frame when checking.

Is there anyway to reset or clear input like email?

Thank!

+5
source share
3 answers

For the record only, refer to OP comments for explanations and see this plunker for a demonstration.

+2
source

In my case, when using the validation form button associated with the scope with the directive ng-disabled, I had to use the double reset logic:

<form>
    <input type="email" ng-model="formdata.email" />
    <button class="btn btn-warning cancel" type="reset" ng-click="formdata = {}">Clear</button>
    <button type="submit" ng-disabled="form.$invalid" />
</form>
  • type="reset": , ( ng-click)

  • ng-click="formdata = {}": . , , ng-disabled , - reset...

+1

, , , . , myModel = {}, . myModel.Email = '',

0

All Articles