0
I have the following problem: ng-click fires twice with a click on the mobile resolution, when running in the browser there is no problem.
$scope.consultaItensMesa = function consultaItensMesa(mesa) {
try {
if (!mesa.show_item) {
$http({
method: 'GET',
url: $rootScope.raiz_ws + 'mesa/item',
params: {
id_pedido: mesa.id_pedido
}
}).then(function successCallback(response) {
if (response.status !== 204) {
if (response.data.resultado !== undefined) {
mesa.itens_mesa = response.data.resultado[0].pedidoitem;
mesa.show_item = !mesa.show_item;
console.log('cai duas vezes por click na resolução dos celilares aqui!!');
}
}
}, function errorCallback(response) {
console.log(response);
});
} else {
mesa.show_item = false;
}
} catch (e) {
alertify.alert(e.message);
}
};
And the HTML:
<div ng-init="init(1)" >
<button class="btn btn-danger btn-fab fa fa-list-ul"
style="background-color: gray" ng-click="consultaItensMesa(mesa)"></button>
Could add to the question the HTML tag that defines the
ng-click
?– Oralista de Sistemas
<button class="btn btn-Danger btn-Fab fa fa-list-ul" style="background-color: Gray" ng-click="query>
– Gabriel Souza
Now that I saw that the code was in the question, I only needed to format as code.
– Oralista de Sistemas
the error occurs when using ngmaterial follows the code var CommerceFast = angular.module('CommerceFast', ['ionic', 'ngRoute', 'ngStorage', 'ui.utils', 'chieffancypants.loadingBar', 'ngAnimate', 'ngCookies','ngMaterial'])
– Gabriel Souza
You don’t need to sign the Function so "$Scope.consultationItensMesa = Function consultationItensMesa(table) {", it would just be "$Scope.consultationItensMesa = Function (table) {". That could be it. You ended up with 2 functions.
– André Vicente