我正在开发一个带有onsen UI(基于角度)+ phonegap的应用程序.所以我在角度控制器中有一个JQuery单击事件,这就是问题所在.
当我返回页面堆栈并再次运行时,它会多次触发点击事件.
我在角度控制器中使用jquery click事件,因为我必须在此事件中使用Onsen UI Service.所以我必须在控制器内声明这个事件.但这就是问题所在.看:
module.controller('ListController', function($scope, EventsService, OneEventService) {
$scope.events = EventsService.getPopular();
//this is the event that is triggering many times
$(document).on("click",".item-from-list",function(e){...}
Run Code Online (Sandbox Code Playgroud)
我尝试使用$(element).click(func)但它无法获取DOM元素.然后我用$(document).on("click", elem, func)
那么我该如何解决这个问题呢?