I have an application where I use zip code to be part of the registry. Only the CEP is enough and it would need to be validated the CEP and at the end of the validation trigger a function. How can I do this?
html:
<input type="text" ng-model="endereco.cep" ng-keyup="pegaCep()" placeholder="CEP">
angular:
$scope.pegaCep = function () {
var cep = $scope.endereco.cep;
if(cep.length <= 8){
return
}else
if(cep.length == 9){
$http.get("http://www.vigilantescomunitarios.com/www/php/pegaCep.php?cep="+$scope.endereco.cep).success(function (endereco){
$scope.endereco = endereco;
});
}
}