Using Cookies

I am trying to user cookies but I get the following error.

ionic.bundle.js:25642 Error: [$injector:unpr] Unknown provider: UserServiceProvider <- UserService <- AuthenticationService

I did the following:

  1. mentioned this in my index.html
    <script src="//code.angularjs.org/1.4.3/angular-cookies.js"></script>

  2. in my app.js I added ngCookies

angular.module(‘app’, [‘ionic’, ‘app.controllers’, ‘app.routes’, ‘app.services’, ‘app.directives’,‘app.filters’,‘ngSanitize’,‘ngCookies’,‘base64’])

  1. then I created a new service, i referenced it in my index.
    <script src="js/authenticationService.js"></script>

  2. I included $cookies in my authenticationService.js

    (function () {
    ‘use strict’;

     angular
         .module('app')
         .factory('AuthenticationService', AuthenticationService);
    
     AuthenticationService.$inject = ['$http', '$cookieStore', '$rootScope', '$timeout', 'UserService','$cookies'];
     function AuthenticationService($http, $cookieStore, $rootScope, $timeout, UserService,$cookies) {
    

Can anyone help me with this error ?

When I change the angular cookies version to 1.2.20, i get this error instead

ionic.bundle.js:25642 TypeError: $browser.addPollFn is not a function at Object. (angular-cookies.js:60)