I have a problem with my AngularJS app. I'm trying to get the browser cookies but when I try to access the cookies it's always empty, I've tried it in Safari, Firefox and Chrome. I found this example below that many confirms work but I can't get it to work, see my comments for the output I'm getting.
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="http://code.angularjs.org/1.0.0rc10/angular-1.0.0rc10.js"></script>
<script src="http://code.angularjs.org/1.0.0rc10/angular-cookies-1.0.0rc10.js"></script>
<script>
angular.module('myApp', ['ngCookies']);
function CookieCtrl($scope, $cookies) {
console.log($cookies) // FireBug: Object { }
$scope.cookieValue = $cookies.text;
}
</script>
</head>
<body ng-controller="CookieCtrl">
Cookie Value: '{{cookieValue}}' <!-- Cookie Value: '' -->
</body>
</html>
I don't get any other errors that indicates that something is wrong.
Thank you in advance, Mattias