Hi all, i am developing my first Ionic app. I am trying to add a login functionality that calls the remote method to log in to my framework.
I made a factory like this one:
app.factory('LoginService', function($http, $q) {
return {
login: function(user) {
var deferred = $q.defer();
$http.post('http://mydomain/users/login.json', user)
.success(function(response, status){
deferred.resolve(response);
})
.error(function() {
console.log('SOMETHING WENT WRONG');
});
return deferred.promise;
}
}
});
In the “user” variable i have the email and password inserted in the login form.
The problem is that if i pass “user” to the post function, the function itself breaks.
So my question is: how i pass the parameters in post to the function?