Angularjs - Forcing input field bind

Asked

Viewed 204 times

1

Good afternoon, you guys! I read that by default Angularjs requires the fields to have some user interaction to perform Binding. How do I ignore this and submit what you have in the input field, even without user interaction? Thank you.

My Javascript is in hmtl itself, I use the code of this site. https://viacep.com.br/exemplo/javascript/

however, I do have a stereo file inside the controller folder (Laravel 5), called cadastro.js the save function inside the.js register is this.

"self.email = {}; self.save = Function() { var errors = []; // Validations if (!self.email.email) { .push errors('E-mail field is required'); }

    if (!self.email.contato) {
        erros.push('O campo Contato é obrigatório');
    }

    if (erros.length > 0) {
        alertService.add('danger', erros);
    }
    else {
        $uibModalInstance.close(self.email);
    }

}; "

here are some of the fields within my html using Angularjs functions. "

ZIP CODE

Addressee "

  • 2

    As far as I know, if you use ng-model, regardless of the user action it will send what exists there.

  • then, I have some input fields that are filled in by javascritpt, it happens that at the time of the model save, it does not leave the fields filled in, unless I type something in them.

  • This shouldn’t happen, try printing the fields with console.log to know if they are really filled in.

  • 1

    If you post your code, we try to help...

No answers

Browser other questions tagged

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