2016-04-14 10 views
0

から特定のデータのみを取得することは私のコード..です私はホーム/ GetAllAttendanceDataにサービスを提供するためにJSON文字列を渡すと私はcontroller.hereでそれを取得したいコントローラ

public JsonResult GetAllAttendanceData() 
    { 
     var ab = (from obj in db.Attendances where obj.Id==1 select new {EmpNTLogin = obj.EmpNTLogin }); 
     return this.Json(ab,JsonRequestBehavior.AllowGet); 
    } 

## Heading ## 
angular.module('myModule', []).service("crudAJService", function ($http) { 
     this.getdata = function() { 
      return $http.get("Home/GetAllAttendanceData"); 
     }; 
    }).controller('myController', function ($scope, crudAJService) { 
     $scope.divBook = false; 
     GetAlldata(); 
     function GetAlldata() { 
      debugger; 
      var getAttendanceData = crudAJService.getdata(); 

      getAttendanceData.then(function (Attendances) { 

       $scope.Attendancesdata = Attendances.data 
       alert($scope.Attendancesdata); 
      }, function() { 
       alert('Error in getting book records'); 
      }); 
     } 
    }); 

私は(警告の文字列を表示したいです$ scope.Attendancesdata);

+0

あなたが今得るか何を、正確に問題は何ですか? –

+0

アラート($ scope.Attendancesdata)で、それは[オブジェクト] [オブジェクト]を示します – akash

+0

私は上記のC#コード – akash

答えて

0

は多分あなたが望むものである。この:

alert(JSON.stringify($scope.Attendancesdata)); 
+0

に渡された文字列を取得したいと思います...それは私のために働く..それは取得する方法を知っているかもしれません同様に配列が渡される – akash

関連する問題