I'm struggling to resolve this issue where I can't seem to make it work. My aim is to integrate NgCookies
(angular-cookies) into my application, but all I'm encountering are errors.
This is what I currently have:
JS files being included:
<html>
<script src="js/angular1.6.1.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-cookies.js"></script>
</html>
Application controller setup:
var myApp = angular.module('myApp', ['ionic', 'ui.router', 'ngCordova', 'ngCookies']);
The specific controller in question:
myApp.controller('HomeController', ['$scope', '$cookies', function ($scope, $cookies) {
// Retrieving a cookie
$scope.userName = $cookies.userName || "";
// Setting a cookie
$cookies.userName = 'testUser';
}]);
The error message that keeps surfacing reads:
Error: [$injector:unpr] Unknown provider: $cookiesProvider <- $cookies <- HomeController
I'm using Angular version 1.6.1 along with Angular-Cookies version 1.6.1
I am at a loss as to what exactly I am overlooking here. While I've referred to other similar queries for solutions, none of them seem to apply in my case. I've double-checked the versions, the order of inclusion of Angular and Angular-Cookies, and yet the issue persists. Any guidance would be greatly appreciated.