I have the following problem: I need a field to be shown in a solution with a "mask" as if it were hidden. When an event occurs or a click on a button (or on itself) such field is filled with a value and after a time it is shown again with its "mask". So:
No HTML
<div ng-click="mudaCampo()">
{{campo}}
</div>
No JS
$scope.campo = '*****';
$scope.valorCampo = 'ola mundo';
$scope.mudaCampo = function(){
//mostro o valor real do campo, existente em outra variável
$scope.campo = $scope.valorCampo;
//volta o valor mostrado no html para a "mascara" anterior
setTimeout(function(){
$scope.campo = '*****';
},2000);
};
My problem is that $scope.campo
even changes to the value of $scope.valorCampo
but the setTimeout
function does not return the same value for the previous mask ... help?
Note
I even tried to see how $timeout
works, but when I try to use it, Angular has an error about the event ...