【发布时间】:2014-09-25 12:00:19
【问题描述】:
你能告诉我如何永久存储数据(例如本地存储)和检索数据。我想存储数据以便再次获取。我正在做客户端编程?我谷歌它说有persistance.js会这样做..我们可以使用它吗?我试图做一个简单的例子来存储数据但不能这样做。我想保存学生和班级姓名的列表。 这是我的笨蛋:http://plnkr.co/edit/cLTIJfETGYENQyEdsu94?p=preview
// Code goes here
var app = angular.module('appstart', ['ngRoute']);
app.config(function($routeProvider) {
// $locationProvider.html5Mode(true);
$routeProvider
.when('/home', {
templateUrl: 'tem.html',
controller: 'ctrl'
})
.otherwise({
redirectTo: '/home'
});
});
app.controller("ctrl", function($scope) {
$scope.students = [];
$scope.add = function() {
$scope.students.push({
inputName : angular.copy($scope.inputName),
inputclass : angular.copy($scope.inputclass)
});
$scope.inputclass='';
$scope.inputName='';
}
}
);
谢谢
【问题讨论】:
-
Angular 与否,原理是一样的:diveintohtml5.info/storage.html
-
@Shomz 感谢更新 ..你能检查我的 plunker 吗?只添加一个条目。剩下的我想我会自己做的。我只想添加它添加到数据库中
-
您使用的是什么类型的数据库?
-
我正在使用客户端语言、jquery、angular.js、HTML5 制作桌面应用程序
-
我只需要添加、删除、编辑条目需要哪种类型的 dB 角度支持
标签: jquery node.js angularjs angularjs-directive angular-ui