I have slowly been making headway with my ionic application. Recently though I had a backend built out using Rails via Heroku and trying to send and recieve data is new territory for me.
So far from the research i have done, it seems using $http won’t work. I have seen it’s recommended to use ngResource with rails, which I have tried, but I don’t seem to be getting anywhere. Can someone give me a basic rundown of how to do this please. Any help would be very much appreciated!
I also keep getting XMLHttpRequest No ‘Access-Control-Allow-Origin’ header is present despite the back end developer telling me that it should work.
Here is my code so far
angular.module('va_disability.login', [] )
.controller('LoginCtrl',['$scope', '$state', 'login', function LoginCtrl($scope, $state, login){
login.query({password: "hello", username: "thomas"});
$scope.goToMain = function(){
$state.go('vanav.main');
};
}]);
angular.module('va_disability.server', ['ngResource'])
.factory('login', ['$resource',
function($resource){
return $resource('https://fmserver.herokuapp.com/users/sign_in');
}]);
I am currently testing the application via chrome using ripple.