Есть такое простенькое приложение. Надо чтобы при закрытии странички, дела сохранились. Я так понял надо через localStorage это организовать.
<!DOCTYPE html>
<html lang="en" ng-app="todoList">
<head >
<meta charset="UTF-8">
<title>Task1</title>
<script src="../Libraries/angular.js"></script>
<link href="../Libraries/bootstrap.css" rel="stylesheet" />
<link href="../Libraries/bootstrap-theme.css" rel="stylesheet" />
<script>
var todoList = angular.module("todoList", []);
todoList.controller("ToDoListCtrl", function ($scope) {
var model = [{
name:'Do',
description: "More",
date: '11.01.2015',
complited: true
}];
$scope.data = model;
$scope.addNewDo = function() {
$scope.data.push({
name: $scope.doName,
description: $scope.doDescription,
date: $scope.doDate,
complited: $scope.doComplite
});
}
});
</script>
</head>
<body>
<div class="container" ng-controller="ToDoListCtrl">
<div class="page-header">
<h1>ToDo list</h1>
</div>
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Date</th>
<th>Complited</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data">
<td>{{item.name}}</td>
<td>{{item.description}}</td>
<td>{{item.date}}</td>
<td>{{item.complited}}</td>
</tr>
</tbody>
</table>
<form>
<div class="form-group">
<label for="exampleName">Name</label>
<input type="text" class="form-control" id="exampleName" placeholder="Enter name" ng-model="doName">
</div>
<div class="form-group">
<label for="exampleDate">Date</label>
<input type="date" class="form-control" id="exampleDate" placeholder="Date" ng-model="doDate">
</div>
<div class="form-group">
<label for="Description">Description</label>
<textarea class="form-control" rows="3" id="Description" ng-model="doDescription"></textarea>
</div>
<div class="checkbox">
<label>
<input type="checkbox" ng-model="doComplite"> Complited?
</label>
</div>
<button class="btn btn-default" ng-click="addNewDo()">Add</button>
</form>
</div>
</body>
</html>