I trying to set a cookie following this approach. However I must have missed something fundamental as the console only returns undefined. Here is the full html content.
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular-cookies.js"></script>
<script>
angular.module('App', ['ngCookies'])
.controller('ctrl', ['$cookies', function($cookies) {
$cookies.put('token', 'Test', {'expires': 'Fri, 31 Dec 9999 23:59:59'});
console.log($cookies.get('token'));
}]);
</script>
</head>
<body ng-app="App" ng-controller="ctrl"></body>
</html>
For the off-case it matters: Chromium 65 on Ubuntu 16.04 (64-bit). Thank you for your help.