javascript - Angular $http calls not working in Chrome or Firefox -
i have simple angular $http.get , post calls. works in ie not in chrome or firefox.
i kept break point in js , debugged, breaks in line of $http.get('urlapi') , don't see guidance this. debug takes me details of angular methods not able follow..
anyone have faced similar issue or guidance here. using angular version 1.5.8.
here simple angular code
$scope.wakeup = function() { $http.get('gettimings').then(function() { } }
please use following: if server side scripting php work: (if asp.net should add web service in web.config file)
imp: please make sure have used ng-app , ng-controller name used in html
<p>today's welcome message is:</p> <h1>{{mywelcome}}</h1> </div> <p>the $http service requests page on server, , response set value of "mywelcome" variable.</p> <script type="text/javascript"> var app = angular.module('myapp', []); app.controller('myctrl', function($scope, $http) { $http.get("welcome.php") // can use welcome.htm .then(function(response) { $scope.mywelcome = response.data; }, function(error){ console.log(error) }); }); </script>
Comments
Post a Comment