Angularjs validation does not work very well

Asked

Viewed 373 times

0

I have a form where it is shown inside a modal, used by the Bootstrap framework, and because of that, the angular validation does not work right. Only some fields are validated and still yes randomly.

An example, I have in this form three fields: Name, Surname & Email. Sometimes the email field is validated and the name too, if I close the modal, these fields are no longer validated. And so it goes.

Would anyone have any tips that could solve this?

The validations are as follows: Email has to be email type and required field Name and surname fields have to be mandatory only.

The code of my form:

          <form class="ui form" name="add_usuario">
            <div class=" required field">
                <label>Email</label>
                <input type="email" ng-model="email" name="email" required>
            </div>
            <div class="required field">
                <label>Nome</label>
                <input type="text" ng-model="nome" name="nome" required>
            </div>
            <div class="required field">
                <label>Sobrenome</label>
                <input type="text" ng-model="sobrenome" name="sobrenome" required>
            </div>
            <div>
               <button class="ui blue ok button" ng-class="{'loading': enviando}" ng-disabled="add_usuario.$invalid || enviando">Salvar</button>
            </div>
        </form>

It is worth remembering that this validation only does not work when it is inside the modal, be put it directly on the page, this validation works without any problem.

  • 4

    edit your question and put the codes used or at least the validation code to see what you’re doing wrong. And what kind of validation do you need? Empty fields? Number of characters? If it is empty field just a required no in input and so on, edit the question and we will be able to help you more.

  • You can put your complete code there, with HTML scripts and modal? tested on which browsers?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.