3
Good morning, I’m beginner with Web, although I know how to program in other languages. My doubt is the following, through the via cep I got the algorithm that fills the address fields through a Javascript.
my imput is this:
input class="form-control" type="text" id="rua" ng-model="cadastro.endereco.endereco" maxlength="60"
Javascript fills in the input when typing the zip code, but when saving, the data that was completed by js is NOT saved. Only the ZIP code, Number and Add-on that were manually typed. Can someone help me? Thank you.
I did so, I used the script of this site https://viacep.com.br/exemplo/javascript/
to mouth the address through the zip code. then I put the same id in js to fill the text area.
input class="form-control" type="text" id="street" ng-model="cadastro.endereco.endereco" maxlength="60"
perfectly fills, it happens that at the time of saving, the fields that were filled by the script are blank, only save the fields that I manually typed as number and address complement
I found that by default Angularjs requires the fields to have some user interaction to perform Binding. Does anyone know how to force Binding into the input field or turn it off at the angle? thank you.
Why don’t you request the Via Cep by Angular?
– adelmo00
I didn’t understand your question, could you rephrase ? i already made an example with this api, from a look at this demo: https://plnkr.co/edit/9Ry6GfYqt2phUsW5iBFop=preview
– Gabriel Rodrigues
Your example is ok. You can ask the example of the question?
– adelmo00
I did so, I used the script of this site https://viacep.com.br/exemplo/javascript/ to address the address via the zip code. dai put the same id in js to fill the text area. input class="form-control" type="text" id="street" ng-model="cadastro.endereco.endereco" maxlength="60" fills perfectly, it turns out that when saving, the fields that were filled in by the script are empty, only save the fields I manually typed as address number and complement
– Celso Lisboa