如何在 angular.js Controller 内调用与 ajax 兼容的 WCF 服务?
我尝试将 Jquery 和 Angular.JS 结合起来,例如:
app.controller('ListUsersController', function () {
var me = this;
this.listusers = [];
this.fill = function () {
$.getJSON("Contact.svc/getjemploye", function (data) {
me.listusers.push({id:"1",name:"Vinc"});
});
};
});
当我将用户插入列表用户时, Controller 似乎看不到我正在向列表中添加某些内容,因此它不会再次显示列表(在 html 中,我看不到新的内容)我刚刚推送的用户)。
最佳答案
Angular 有自己的一组 Ajax 调用者。
$http({ method: "GET", url: "http://yoururlhere.com")
.success(function (response) {
alert("success!");
});
关于javascript - angular.js 调用 ajax 兼容的 WCF 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25163006/