I have an app on Ionic that sends messages. I have already helped, here in the forum, to make a way that does not allow the user to touch the button send, without typing anything, so the message does not go blank. Blz, it works cool
<button class="button button-clear button-positive" ng-disabled="msgForm.msg.$invalid && disableButton" ng-click="enviarMsg(mensagem)">Enviar</button>
controller:
$scope.enviarMsg = function (mensagem) {
$scope.disableButton = true;
var dia = moment().format(); //2016-02-16 T 16:05:52-02:00
var diaP = dia.split('T');
var dia = diaP[0];
var horaP = diaP[1];
var horaP2 = horaP.split(':');
var hora = horaP2[0]+':'+horaP2[1];
var enviaMsg = {
mensagem: mensagem,
idUsuario: $window.localStorage.getItem('idUsuario'),
idCep: $window.localStorage.getItem('idCep'),
nome: $window.localStorage.getItem('nome'),
dia: dia,
hora: hora
}
$http.post("http://www.vigilantescomunitarios.com/www/php/enviaMsgLogra.php", enviaMsg).success(function (data){
$scope.disableButton = false;
pegaMsgsLogra();
$scope.mensagem = {
msg: ""
}
});
}
However, since the message sometimes times out, I would like the button also disabled, and the field, too, until the message is sent. How could I do that? because I'm already using ng-disabled on the button.