I am facing problem while using angular-js with
$locationProvider.html5Mode(true).hashPrefix('!');
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:
HTML
<button type="button" class="btn btn-default" ng-click='doLogin()'>Sign in</button>
APPLICATION SCRIPT
var app = angular.module('starter', ['ngRoute','ngCookies']);
app.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/dashboard', {
templateUrl: 'pages/dashboard.html',
controller: 'dashboardApp'
})
.otherwise({
redirectTo: '/',
templateUrl: 'pages/login.html',
controller: 'loginApp'
});
$locationProvider.html5Mode(true).hashPrefix('!');
})
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);
};
})
.HTACCESS
#BEGIN
Options +FollowSymLinks
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^ index.html [L]
</ifModule>
#END