0
希望我不復制現有的問題... 我試圖訪問附加到「我的服務」中的「this」的函數,但是我必須從內部執行此操作jQuery的事件綁定。訪問jQuery代碼中的角度範圍
但我從角度得到「undefined不是函數」的錯誤。
代碼:
app.service("whatever",function(){
this.instantiatePreIds = function() {
/**whatever code**/
}
this.checkOnLoad = function() {
angular.element(window).bind("popstate", function (e) {
this.instantiatePreIds(); /***this row throws that error***/
});
}
});
有什麼建議?謝謝。