JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html>
<html ng-app="myApp">
<head>
  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular-cookies.js"></script>

</head>
<body ng-controller="CookieCtrl">

Cookie Value: {{cookieValue}}

</body>
</html>

JavaScript

setCookie('haha', 'hoho', 100000);

console.log('cookie', document.cookie);

angular.module('myApp', ['ngCookies']);
function CookieCtrl($scope, $cookies) {
    console.log('haha', $cookies.haha);
    console.log('City', $cookies.City);
    $cookies.City = 'London';
    $scope.cookieValue = $cookies['City'];
}



function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}