I am Trying to make code for fetch records in angularjs but didn't get any solution please help me
<div ng-app="" ng-controller="customersController">
<ul>
<li ng-repeat="x in names">
{{ x.Status }}
</li>
</ul>
</div>
<script src= "//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script>
function customersController($scope,$http) {
$http.get('http://192.168.0.62:8081/DataAccess/rest/userservice/quicksignup/email/[email protected]')
.success(function(response) {$scope.names = response;});
}
</script>
O/p of json[{"Status":"Unverified","EmailForVerification":"Sent","User_role":"User","signup":"true"}]
Your code looks fine. Please check if IP address and port you are running the angular application is same where your webservice is deployed i.e 192.168.0.62:8081
If they are different, please click F12 on browser (Chrome) and click Console Tab to see the output. If you are getting CORS error something like below -
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Try adding below line in webservice implementation. "Access-Control-Allow-Origin: *" For more info see - http://enable-cors.org/index.html