我正在運行此jquery的片段以從基於ui-router的角度應用程序中刪除所有事件偵聽器,但似乎沒有anyhting?這是非法行爲嗎?
$rootScope
.$on('$stateChangeStart',
function(event, toState, toParams, fromState, fromParams){
console.log("Going to remove event listeners"); // this fires
$(document).off();
});
我也試着在chrome dev控制檯中運行它,沒有錯誤。我仍然可以在元素選項卡>>「事件監聽器」 – rex