Category Archives: angular-cookies

angular $cookieStore not working under controller $scope functions

I am facing problem while using angular-js with


Everything Working fine with routing, expect $cookieStore not working under the functions defined in controller $scope, may be because of the .HTACCESS i added.

i can't find any solution,now using "window.localStorage" anybody here have a solution

my sample code is follow:


 <button type="button" class="btn btn-default" ng-click='doLogin()'>Sign in</button>


var app = angular.module('starter', ['ngRoute','ngCookies']);

 app.config(function($routeProvider, $locationProvider) {

    .when('/dashboard', {
    templateUrl: 'pages/dashboard.html',
    controller: 'dashboardApp'
    redirectTo: '/',
    templateUrl: 'pages/login.html',
    controller: 'loginApp'

app.controller('loginApp', function($scope , $cookieStore ) {

    //This working fine
    $cookieStore.put('Greet','Welcome to Angular!');

    $scope.doLogin = function()
           // Here no cookie has been setting up
           $cookieStore.put('loggedin', true);



Options +FollowSymLinks

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^ index.html [L]