If your function is within the scope of your controller, you can simply do so using the ng-blur
:
<input type="text" ng-blur="getCep()">
If not, do so with the onBlur
even:
<input type="text" onblur="getCep()">
Example
function controller($scope){
$scope.getCep = function(){
$scope.demo = $scope.cep;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app ng-controller="controller" >
<input type="text"
ng-model="cep"
ng-blur="getCep()"
ng-focus="demo = ''"
><br>
{{demo}}
</div>
In the above example I just simulated the function getCep()
making it shows what was typed when giving a Blur in the text box. Likewise I used the ng-focus
to leave the var demo
empty.
For an input to call a function it is not necessary to call the Angular, unless you want to change the state of an object at the angular,
<input onblur="SuaFuncao();" />
– Roger Barretto