Hey everyone, I'm a beginner with AngularJS and I've run into a problem while working on my project.
I encountered this error:
ReferenceError: $http is not defined
when attempting to utilize the following code:
'use strict';
myApp.factory('loginService', function() {
return {
login: function(user) {
var $promise = $http.post(
'http://unexus-api-dev-3urcgetdum.elasticbeanstalk.com/users/login', {
headers: {
'Authorization': 'Token token=\"bc0a3f1cfeaf2d9ad98edd005a756ae9\"'
},
user
});
$promise.then(function(msg) {
if (msg.data == 'success')
console.log('success login');
else
console.log('failed login');
});
}
}
});
I acknowledge that my code may be messy, but any assistance you can provide would be greatly appreciated.