Vinc 웃
Vinc 웃

Reputation: 1247

angular.js call an ajax compatible WCF service

How can you call an ajax compatible WCF service inside a angular.js controller ?

I tried to combine Jquery and Angular.JS, something like :

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"});

       });
    };
});

When I push the user inside the listusers, it look like the controller can't see I am adding something to the list, so it doesn't show the list again (In the html, I can't see the new user I just pushed).

Upvotes: 0

Views: 808

Answers (1)

Doug Johnson
Doug Johnson

Reputation: 560

Angular has its own set of Ajax callers.

$http({ method: "GET", url: "http://yoururlhere.com")
.success(function (response) {
  alert("success!");
});

Upvotes: 1

Related Questions