3
我有以下控制器的正常工作:。
function Controller() {}
Controller.prototype = {
getResult: function(project) {
var that = this;
jQuery.ajax({
async: false,
url: "/my-service/call?project=" + project,
dataType: "json",
success: function(data) {
that.result = data;
}
});
}
};
我想使用AngularJS .scope $綁定,看看我是否能消除「無功即=這個;'黑客攻擊。但以下不起作用:
function Controller() {}
Controller.prototype = {
getResult: function(project) {
angular.scope.$bind(jQuery.ajax({
async: false,
url: "/my-service/call?project=" + project,
dataType: "json",
success: function(data) {
this.result = data;
}
}))();
}
};
我錯過了什麼?
請不要多次提問相同的問題。謝謝。 – Kev
@Graham在這個問題中的用戶詢問'angular.scope'作爲編程構造,而不是作爲庫的名稱。標籤旨在用於可搜索性。 –