Hi Guys,
I just found ionic and create a project by issuing the command: ionic start myApp tabs.
The sample works beautifully, however when I push the friends list to a remote MySQL server and getting into Cross-Origin Request Blocked issue. The only part got changed was in services.js
angular.module(‘starter.services’, [‘ngResource’])
.config([’$httpProvider’, function($httpProvider) {
$httpProvider.defaults.useXDomain = true;
delete $httpProvider.defaults.headers.common[‘X-Requested-With’];
}
]).factory(‘Friends’, [’$http’, function ($http) {
var friends = {};
return {
all : function () {
var friends = $http({method: “GET”, url:“https://remoteserver@xxx.xxx.xxx.xxx/test/services/getTask.php”});
console.log(friends);
return friends;
},
get: function(friendId) {
// Simple index lookup
return friends[friendId];
}
}
}]);
The https://remoteserver@xxx.xxx.xxx.xxx/test/services/getTask.php works in another Angularjs Task Manager example without CORS issue, but don’t know what I have to do to get it work. Please Help, Thanks.