Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49087

Using Cookies

$
0
0

@nooreo92 wrote:

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'])

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

4) 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)

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49087

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>