重粒子的运行轨迹

Compiling ...
baryon.cpp
baryon.cpp(1) : warning C0000: all glory is fleeing

导航

AngularJS实战之cookie的读取

<!DOCTYPE html>
<html ng-controller="cookies_controller">
<head>
<title>cookies.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

</head>

<body>
	<div ng-click="init()">设置</div>
	<div ng-click="get()">获取</div>
	<div ng-click="remove()">移除</div>
</body>
<script type="text/javascript" src="../plugins/angular/angular.js"></script>
<script type="text/javascript"
	src="../plugins/angular/angular-cookies.min.js"></script>
<script>
	var cookies = angular.module("cookies", [ 'ngCookies' ]);

	cookies.controller("cookies_controller", function($scope, $cookieStore) {
		//设置和读取
		$scope.init = function() {
			alert(new Date(new Date().getTime()));
			$cookieStore.put("book", {page : "120",price : 23});
		};
		$scope.get=function(){
			alert(angular.toJson($cookieStore.get("book")));
		};
		$scope.remove=function(){
			$cookieStore.remove('book');
		};
	});
	angular.bootstrap(document, [ 'cookies' ]);
</script>
</html>

posted on 2017-11-21 12:53  重粒子  阅读(368)  评论(0编辑  收藏  举报