javascript - angular.js 调用 ajax 兼容的 WCF 服务

标签 javascript .net ajax angularjs wcf

如何在 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/

相关文章:

javascript - 包装 float 元素后最小化行,同时最小化宽度

javascript - AngularJS 缓存 $http.post 响应

c# - ASP.NET MVC : removing item from a list in a nested structure always removes the last item 中的异常行为

php - 我的 ajax 代码没有从 php 发送每一行

javascript - jQuery - Ajax 在某些帖子上返回错误 500

javascript - 事件处理程序在 jsfiddle 中无法正常工作

javascript - 如何用异步代码实现顺序迭代

javascript - 如何在 yeoman Angular bootstrap-saas i 中从 main.scss 生成 css

.net - 在 .Net Web 服务中抛出 SoapException

javascript - Angular JS - $q.all() 跟踪个人上传进度