ng-click fires twice with a click on mobile resolution

Asked

Viewed 187 times

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?

  • <button class="btn btn-Danger btn-Fab fa fa-list-ul" style="background-color: Gray" ng-click="query>

  • Now that I saw that the code was in the question, I only needed to format as code.

  • the error occurs when using ngmaterial follows the code var CommerceFast = angular.module('CommerceFast', ['ionic', 'ngRoute', 'ngStorage', 'ui.utils', 'chieffancypants.loadingBar', 'ngAnimate', 'ngCookies','ngMaterial'])

  • 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.

1 answer

0


Look, I saw that it was still open that question but I already solved some time ago. The error was that one of the libraries of the project was with the wrong version, I gave rollback and returned to work!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.