Skip to content

Wcf service not binding in controller

Prerna Bhadwal

Asked Dec 17, 2017, 8:44 AM EST1 answer
Share
LinkedInX
I am calling a wcf service using angular js, but it's not binding the data in my ui grid.Please help
Controller code-
JavaScript
///

///



var angular = angular.module('uigridApp', ["ui.grid"]);


angular.service("UserListingService", function ($http) {
    this.getdata = function () {
        var response = $http.get("http://localhost:58816/Service1.svc/SelectEDocsUserDetails");
        return response;
    }
});
angular.controller('uigridCtrl', function ($scope, UserListingService) {
    getAlldata();
    function getAlldata() {
        var response = UserListingService.getdata();
        response.then(function (d) {
            $scope.emp = d.data;

        }, function () {
            alert("Error in feaching the record");
        });
    };
$scope.users = [{ name: "pre", age: "12", location: "jammu" },
{ name: "riya", age: "12", location: "jammu" },
PowerShell
    { name: "inku", age: "12", location: "jammu" }
    ];
  $scope.gridoptions = {

        // data: 'users',
data: 'emp',
showColumnFooter: true,
enableColumnresize: true
Code
    };



});
       -----------------------
Html code
<!DOCTYPE html>

User Details

--------------------------------------

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    What error u r getting ? can u check the browser console ? and post the error u are getting there
    0