Test AngularJS Cookie read/write
A simple test in AngularJS with ng-cookies
HTML
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular-cookies.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.6/angular.js"></script>
<header>
AngularJS CookieTest
</header>
<div ng-controller="testCtrl">
<tr ng-repeat="User in Users">
<td>{{User.Name}}</td>
<td>{{User.ID}}</td>
<td>{{User.DOB}}</td>
<td>{{User.Status}}</td>
</tr>
</div>
CSS
header{
width:100%;
padding:20px;
text-align:center;
font-size:30px;
font-style:bold;
}
div{
width:100%;
padding:20px;
text-align:center;
font-size:25px;
}
.redText{
color:red;
}
JavaScript
var myApp = angular.module('cookiesExample',['ngCookies']);
myApp.controller('testCtrl', ['$scope','$cookies', function ($scope,$cookies) {
$scope.users = [{ "ID": "5001", "Name": "None" },
{ "ID": "5002", "Name": "Glazed" }];
$cookies.user_dataff = $scope.users;
$scope.Users= $cookies.user_dataff ;
}]);