Click here to view the error message
Encountered error $injector:unpr Unknown Provider for $cookies
I included the ngcookies module in my app.js file and am using the $cookie service in my controller. However, I am unable to create a cookie as it throws an error when the cookie service is injected in my controller.
app.js
angular.module('advogeApp', [
'ngResource',
'ngCookies',
'editorCtrl',
'SigninCtrl',
'SignupCtrl']).config(['$routeProvider', function($routeProvider, $httpProvider, $cookies){
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
}]);
controller.js
var app = angular.module('advogeApp');
app.controller('SigninCtrl', ['$scope', '$http', '$cookies', '$location', function($scope, $http, $cookies, $location) {$scope.loginData = function () {
angular.element('#signin').modal("hide");
$http({
method : 'POST',
url : '/proxy/',
headers: {'Content-Type': 'application/json', 'endpoint' : '/login/'},
data : JSON.stringify({email : $scope.userEmail, password : $scope.userPwd}),
}).then(function(response){
$cookies.put('set-cookie', response.data.headers['set-cookie']);
if (response.data.body.info == "sucessfully logged in") {
$location.path('/dashboard');
} else {
$scope.logininfo = response.data.info;
console.log(response.data);
}
},function(response){
console.log(response);
});
Seeking assistance in resolving this error