Hi All,
I have created factory and sending some $http requests like the below code.
'use strict';
angular.module('roadApp')
.factory('getApiData', [ '$http' ,
function ($http) {
return{
getData: function(regno, servType, servLoc){
return $http({
url:
'demoLink='+regno+'&username=api&tes=test&serviceType='+servType+'&serviceLocation='+servLoc,
method: 'GET'
});
}
}
}]);
In controller I am calling the api by using form field value.
'use strict';
angular.module('demmoModule')
.controller('MainCtrl',[ '$scope','$location','$rootScope','getApiData',
function ($scope, $location, $rootScope, getApiData) {
$rootScope.formdata=[];
$scope.loadingStatus = false;
$scope.test = 'nothing';
$scope.showpop = "hidePop";
$scope.update = function(getdata, formstatus) {
if (!formstatus) {
$scope.showpop = "showPop";
}
else
{
$scope.loadingStatus = true;
$scope.formdata = $scope.user;
$scope.jsonContent = getApiData.getData($scope.formdata.reg,
$scope.formdata.serviceType,
$scope.formdata.serviceLoc).success(function(data, status){
console.log(status);
$rootScope.formdata=data;
if(status==200){
$location.path("/road-assistance");
}
})
.error(function(data, status, headers, config){
alert("Data "+data+" Status "+status+" headers "+headers+" config "+config);
$scope.showpop = "showPop";
$scope.loadingStatus = false;
});
}
};
$scope.hidepopup=function(){
$scope.showpop = "hidePop";
};
}]);
In all browsers it is working fine but in ie8 it is going directly to the
error function. Is there any problem with my code? Please suggest. Thanks
in advance.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.