angularjs - success is not defined in Angular $http.jsonp -
i'm making $http.jsonp request in angular/phonegap app. data being delivered remote server, can't response success function in angular app. console telling me 'success not defined.'
here angular code:
app.controller('maincontrol' , function($scope , $http){ $scope.credentials = {username: '' , password: ''}; $scope.login = function(){ console.log($scope); var url = "http://127.0.0.1:3000/endpoint?callback=json_callback"; var responsepromise = $http.jsonp(url, {params: { username:$scope.credentials.username, password:$scope.credentials.password }}); responsepromise.success(function (data){ console.log(data); }) } })
am missing step in order define success?
i believe jsonp have use .then method of handling promise resolution:
responsepromise.then(function (data){ //success things go here console.log(data); }, function(data({ //error things go here });
Comments
Post a Comment