我無法理解$ scope.search在做什麼,比如,當它設置等於函數時它正在做什麼?而且,如果我想以其他方式做,我該怎麼做?
(我使用的角度JS,1.6版本)
$scope.search = function(){
query.get($scope.username , {
success: function(gameScore) {
console.log(gameScore);
return gameScore;
},
error: function(object, error) {
console.log("Sorry, this user does not exist yet");
}
});
};
請參閱[爲什麼不推薦使用角度$ http成功/錯誤方法?從v1.6中刪除?](http://stackoverflow.com/q/35329384/5535245) – georgeawg
名爲'search'的$ scope屬性被分配了對匿名函數的引用。請參閱[MDN JavaScript參考 - 函數表達式](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function) – georgeawg