The largest Interview Solution Library on the web



Warning: include(../../menu/leftMenu/angularjs-cookies.php) [function.include]: failed to open stream: No such file or directory in /home/javatech/public_html/question/angularjsexample/angularjs-cookies.php on line 36

Warning: include(../../menu/leftMenu/angularjs-cookies.php) [function.include]: failed to open stream: No such file or directory in /home/javatech/public_html/question/angularjsexample/angularjs-cookies.php on line 36

Warning: include() [function.include]: Failed opening '../../menu/leftMenu/angularjs-cookies.php' for inclusion (include_path='.:/opt/alt/php53/usr/share/pear:/opt/alt/php53/usr/share/php') in /home/javatech/public_html/question/angularjsexample/angularjs-cookies.php on line 36
« Previous | 1 | 2 | 3 | Next »
Name:

<html>
<head>
<title></title>
<style type="text/css">
body
{
font-family: Arial;
font-size: 10pt;
}
</style>
</head>
<body>
<script type="text/javascript">
var app = angular.module('MyApp', ['ngCookies']);
app.controller('MyController', function ($scope, $window, $cookieStore) {
$scope.WriteCookie = function () {
$cookieStore.put("Name", $scope.Name);
};
$scope.ReadCookie = function () {
$window.alert($cookieStore.get('Name'));
};
$scope.RemoveCookie = function () {
$cookieStore.remove('Name');
};
});
</script>
<div ng-app="MyApp" ng-controller="MyController">
Name:
<input type="text" ng-model="Name" />
<br />
<br />
<input type="button" value="Write Cookie" ng-click="WriteCookie()" />
<input type="button" value="Read Cookie" ng-click="ReadCookie()" />
<input type="button" value="Remove Cookie" ng-click="RemoveCookie()" />
</div>
</body>
</html>
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com