0
我是一位javascript /角色新手,在理解範圍的工作原理時遇到了一些麻煩。我有以下的代碼是不是由於規模問題發揮作用:AngularJS的範圍界定問題
角:
this.myFxn = function() {
var x = this.myModel; //this.myModel is set by an ng-model in the html
myService.myServiceFxn(x.Id)
.then(function (response) {
this.myModel = "";
});
};
我相信這個問題是我自己參考this.myModel的。那麼()內。我怎樣才能正確引用這個變量沒有任何範圍問題?
感謝您給予任何幫助! :)
謝謝!這很好! :) – eclaire211