JavaScript Angular ui sref not working with touch events angular ui-sref not working

i have a link with ui-sref attribute and also a jQuery touch event, but the problem is that when i click on this element the jQuery handler is running but the ui-sref not.

Jquery:

$('#fa-bar, #mobile-nav li').on('touchstart', function( e ) {
      e.stopPropagation();
      $('#mobile-nav').toggleClass('toggle-mobile-nav');
      $('#mobile-nav').toggleClass('prevent-scroll');
 });

Html:

 <li ui-sref="state" ui-sref-active="nav-active"><a>Link</a></li>
Answer:1

See the docs and this example:

However, stopEvent also calls an event object method, event.stopPropagation, which keeps the event from bubbling any further up into the DOM. Note that the table itself has an onclick event handler that ought to display a message when the table is clicked. But the stopEvent method has stopped propagation, and so after the data in the table is updated, the event phase is effectively ended, and an alert box is displayed to confirm this.

This is pure javascript and also applies for AngularJS. Your call to e.stopPropagation() prevents ui-router from getting the event. This is sometimes handy if you want to add an URL to something (so you can still use open-in-new-tab feature of your browser), but want a different behavior on normal clicks.

Answer:2

I am new to Angular and have a situation where I must pass in an object into an attribute of an element inside an ng-repeat. The code works fine when returning the new object if I do not use ajax to ...

I am new to Angular and have a situation where I must pass in an object into an attribute of an element inside an ng-repeat. The code works fine when returning the new object if I do not use ajax to ...

  1. angularjs infdig error
  2. infdig angular error
  3. angular rootscope infdig error

i am new in Phonegap development. In my current project, i want to get user profile name, gmail and email address. I know how to retrieve these information in native Android. By using which plugin, i ...

i am new in Phonegap development. In my current project, i want to get user profile name, gmail and email address. I know how to retrieve these information in native Android. By using which plugin, i ...

I'm trying to create a gulpfile that lint my personal javascript files (.js) but ignore any vendor/third party libaries. My gulp file is listed below: var gulp = require("gulp"), uglify = ...

I'm trying to create a gulpfile that lint my personal javascript files (.js) but ignore any vendor/third party libaries. My gulp file is listed below: var gulp = require("gulp"), uglify = ...

I am trying to display data from database in angularjs using webservice But geting Error[object Object] while retriving data My web method is: <WebMethod()> _ <ScriptMethod(ResponseFormat:=...

I am trying to display data from database in angularjs using webservice But geting Error[object Object] while retriving data My web method is: <WebMethod()> _ <ScriptMethod(ResponseFormat:=...

  1. display data from another sheet in excel
  2. display data from database in html
  3. display data from mysql in php
  4. display data from database in django
  5. display data from firestore
  6. display data from database in python
  7. display data from csv in html
  8. display data from database in python flask
  9. display data from excel in html
  10. display data from api in html
  11. display data from javascript to html
  12. display data from database in tkinter
  13. display data from database in asp.net c#
  14. display data from database in gridview in mvc
  15. display data from google spreadsheet on website
  16. display data from google sheets on website
  17. display data from database in wordpress page
  18. display data from database
  19. display data from two tables in sql
  20. display data from database in laravel