My web app is using angularjs with spring mvc. When hosted in localhost the http get works fine in all browsers. But once hosted in a diferent server the http get returns the html of main tenplate page as result instead json.This wrong happen only chrome. No erros show in browser console. Someone can help me.
app.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
angular.module('myModule').factory('myService', function($http, $q, CONTEXT_APP) {
return {
getPromiseFunction: function(id) {
var deferred = $q.defer();
$http.get(CONTEXT_APP + '/mvc/id/' + id).success(function(result){
deferred.resolve(result);
});
return deferred.promise;
}
};
});
angular.module('myControllerModule').controller('SecondController', function($scope, $routeParams, myService) {
var promise = myService.getPromiseFunction($routeParams.id);
promise then(function(result) {
$scope.result = result;
});
});