<form> <div ng-app="myApp" ng-controller="questionsController"> search:<input type="text" ng-model="search" /> <table> <tr ng-repeat="i in questions | filter:search"> <td>{{i.PatientId}} </td> <td>{{i.PatientName}} </td> </tr> </table> </div> <script> var app = angular.module('myApp', []); app.controller('questionsController', function ($scope, $http) { var url = "WebService.asmx/GetUserDetails"; $http.get(url) .success(function (data) { alert("success"); var myjson = JSON.parse(data); $scope.questions = JSON.parse(myjson); }) .error(function (data) { alert("error"); alert(data); }) }) </script> </form>
public class WebService : System.Web.Services.WebService { public static HospitalEntities _entities = new HospitalEntities(); public WebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public static string GetUserDetails() { var data = _entities.PatientReg.ToList(); var jsondata = new JavaScriptSerializer().Serialize(data); return jsondata; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)