javascript - controller is hitting the server but data is not displaying in angularjs -
when click on button go controller , hit server through api , return data html page.
have created own api , placed in cloud accessing through web address, not using other sites api. code written hitting server through api data not displaying.
my html code
<body ng-app="myapp"> <div ng-controller="testctrl"> <button ng-click="loadtestctrl()">load ctrl</button> {{result}} </div>
my controller code
app.controller("testctrl",function($scope,$http){ $scope.loadtestctrl = function(){ $http.get("http://192.168.0.103:8081/kunera-pos/franchise/getfranchise/").then(function(response){ $scope.result = response.data; }); } });
the 3 error getting
error 1
failed load resource: server responded status of 404 (not found)
error 2
xmlhttprequest cannot load http://192.168.0.103:8081/kunera-pos/franchise/getfranchise/. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8080' therefore not allowed access.
error 3
possibly unhandled rejection: {"data":null,"status":-1,"config":{"method":"get","transformrequest":[null],"transformresponse":[null],"jsonpcallbackparam":"callback","url":"http://192.168.0.103:8081/kunera-pos/franchise/getfranchise/","headers":{"accept":"application/json, text/plain, /"}},"statustext":""}
i cant find out making mistake.
i using angularjs cdn 1.6.5
in advance
wiki
Comments
Post a Comment