Hello I'm wondering what is the way to use $cookieStore inside the redirectTo function of the routeprovider... I'm trying to achive this:
angular.module('App.section', ['ngCookies'], function ($httpProvider, $cookieStore) {})
.config([
'$routeProvider', '$cookieStore',
function ($routeProvider, $cookieStore) {
$routeProvider
.when('/section/page', {
controller: 'SectionCtrl',
templateUrl: 'section/page.tpl.html',
redirectTo: function (routeParams, path, search, $cookieStore) {
console.log($cookieStore); // undefined
return pathString;
},
resolve:{ ... something}
})
}
])
I want to be able to figure it out to where should I send the redirection depending on cookiestore.