Recognition of the ng-click function in Ionic buttons can occasionally be unreliable

I am experiencing an issue with my Ionic app that wraps a web-app using Angular. Within the app, there are buttons coded like this:

<ion-view view-title="Orders">
  <ion-content scroll="true" overflow-scroll="true">
    <div class="row">
        <!-- some other divs with text only -->
    </div>
    <div class="row">
      <div class="col-xs-12">
        <button type="button" ng-click="vm.go('orders.new')" 
           class="button btn btn-lg btn-info">new order</button>
      </div>
    </div>
  </ion-content>
</ion-view>

My problem is that sometimes the vm.go() method does not execute when I tap or touch the button. This issue occurs with iOS devices running Ionic and Cordova, but works fine on Chrome and Android devices. Even when using Safari browser on iOS, it functions correctly.

This leads me to believe that the issue lies within Ionic and/or Cordova rather than the code itself.

If I manually attach an event handler (using plain JavaScript and getElementById()) to the button to capture touch or mouse events, they trigger as expected, but ng-click does not. In cases where the button's method fails to fire properly, the view ends up scrolling to the top instead.

It appears to be a kind of race condition, causing inconsistent behavior where ng-click is sometimes invoked and sometimes not.

I am currently using Ionic 1.3.2 and cordova 6.0.0 versions. Does anyone have insight on how to resolve this issue?

Answer №1

Blocking click for 330ms can be achieved by adding a single div,

To enable responsiveness from the start, include the following code in the "beforeenter" event:

angular.element(document.getElementsByClassName('click-block')).addClass('click-block-hide');

This will ensure that the view is responsive right from the beginning.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Struggling to understand the javascript snippet "requiring the passport file and passing in passport as a parameter."

I am still learning the ropes of javascript and currently working on a basic login restful api using the passport middleware. I understand that when I use require('xxxxx'); I am importing a module for use. While researching online, I came across ...

Error encountered when attempting to add usage description for NSPhotoLibrary

Looking for some assistance here. I have this project in Xcode / Unity, and every time I try to build it, I encounter the following error: This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app& ...

The Shopify cart.json request has encountered a setback with error 330

My current task involves using jQuery to retrieve cart data from Shopify, which I then display on another website. However, this process has suddenly stopped working. When I attempt to make the request in Google Chrome, it shows as 'failed' and u ...

Angular UI Grid failing to properly display date formatting

Currently, I am using Angular's UI Grid to showcase multiple columns. However, I am facing an issue with formatting the date column. The date is being displayed as /Date(1451346632162-0000)/, and similar formats. I have attempted to apply filters in ...

The attempt to connect with react-native-fetch-blob has not been successful

How do I resolve the issue of displaying a PDF from my assets folder in an Expo, React Native project using react-native-pdf? While scanning folders for symlinks, encountered an error with RNFetchBlob library in my project directory. The automatic linki ...

The useEffect hook in ReactJs is triggering multiple times

Encountering challenges while developing an Infinite scroll using ReactJs and Intersection observer API. Upon initial application load, the API gets called twice instead of once. This behavior may be due to strict mode, although not confirmed. Additionall ...

Consolidating queries to minimize the number of HTTP requests

I am facing a challenge with multiple http requests in my Angular 1 app causing bottlenecks for other requests. Let's say I have Users data sourced from various tables like: user.signup +-----+------------+ | uid | date | +-----+------------+ | ...

The daily scripture quote from the ourmanna.com API may occasionally fail to appear

I've been trying to display the daily verse from ourmanna.com API using a combination of HTML and JS code, but I'm encountering an issue where the verse doesn't always show up. I'm not sure if this problem is on the side of their API or ...

The Vue component does not render the JS Promise and instead displays it as

After setting up a promise that will be returned once a correct event is called with the correct action, I have the following code: import {EventBus} from "./EventBus"; export function completed() { EventBus.$on('queue-action', e => { ...

Is the variable leaping to a superior scope?

A few days back, I encountered a strange bug in my code that has left me puzzled. It appears that a variable declared within a narrower scope is somehow leaking into a broader one. Any insights into what might be going wrong here? Here's a simplified ...

Having trouble displaying the output on my console using Node.js

Hey there, I'm new to this community and also new to the world of nodejs technology. I have encountered a problem that may seem minor to you but is quite big for me. Here's what's going on: In my code snippet, I want a user to input 3 value ...

How can we integrate this icon/font plugin in CSS/JavaScript?

Check out the live demonstration on Jsfiddle http://jsfiddle.net/hc046u9u/ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materializ ...

mongojs implementation that allows for asynchronous query execution without blocking

Forgive me for asking what may seem like a silly question, but I am struggling to make this work. Currently, as part of my learning journey with node.js and mongojs, I have encountered the following issue: Below is my server.js file server.get("/", funct ...

Modifying the content within a DIV element

I want to make changes to my DIV. <div id="main"> <div id="one"> <div class="red"> ... </div> <img class="avatar" src="img/avatar1.jpg"/> <span class="name"> John < ...

What is the best way to access a cached value?

I am currently utilizing the node-cache-manager library to manage caching in my Node.js application. After successfully adding an item to the cache using the following code: import cacheManager from 'cache-manager'; const memoryCache = cacheMan ...

Steps for modifying material-ui timepicker to display time in a 24-hour format

Presently, I am utilizing a Timepicker from material-ui. It is currently configured with type="time", allowing me to select times throughout the day in 12-hour increments with an AM / PM choice. However, I wish to adjust my picker to a 24-hour format, elim ...

The framework of AngularJS modules

As I delve into structuring multiple modules for our company's application, I find myself at a crossroads trying to design the most optimal architecture. Research suggests two prevalent approaches - one module per page or a holistic 'master' ...

The FBLoginView experiences a crash when a user's account is found in the Settings section under Facebook

When using the facebookSDK FbLoginView, I encounter a crash after clicking ok to allow access to basic profile info and friends list. The error handling code looks like this: else if (errorCategory == FBErrorCategoryUserCancelled) { // The user ha ...

Obtain the user's email using nodemailer

I created a contact form using Nodemailer that I am having trouble with. Take a look at the code below: let mailOptions = { from: '<<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e3636360e363636602d2123">[emai ...

The function $.fn.dataTable.render.moment does not exist in npm package

I have encountered an issue with my application that I am struggling to solve: I want to format dates in my data table using Moment.js like I have done in the following script: $().ready(function() { const FROM_PATTERN = 'YYYY-MM-DD HH:mm:ss.SSS&a ...