保存文本框数据并从本地存储返回 - angularJS -
Save textbox data and return from localstorage - angularJS -
当页面刷新时,我想将数据从范围返回到文本框值。如何仅使用更新按钮来做到这一点?
示例:普伦克
在 plunker 索引中进行此更改.html
<script>
angular.module("example", ["ngStorage"])
.controller("ExampleController", function($scope, $localStorage) {
$scope.save = function() {
$localStorage.message = $scope.zafer;
console.log(zafer);
}
$scope.load = function() {
$scope.zafer = $localStorage.message;
}
})
</script>
</head>
<body ng-app="example">
<div ng-controller="ExampleController" ng-init="load()">
<input type="text" ng-model="zafer">
<button ng-click="save()">Update</button>
</div>
</body>
相关文章:
- 存储区向变量返回了结果
- 使用Javascript数组或JSON来存储AJAX请求的返回值,以备将来使用
- 在本地存储中保存并返回随机生成的字符串
- 如何将返回的路由对象串行化并本地存储在传单路由机中
- Scala提升了如何运行javascript函数并将返回值存储在变量中
- Azure documentdb存储过程返回部分结果
- 本地存储返回空对象
- 了解存储的MongoDB javascript函数中MongoDB命令的返回类型
- 将数字转换为16位浮点(存储为字节)并返回
- 当点击一个标记时,地理编码器返回先前存储的值
- Angular,GitHub API,返回存储库和标签
- 本地存储返回未定义的变量
- 保存文本框数据并从本地存储返回 - angularJS -
- Android WebView 数据库存储返回 null
- Javascript没有't等待存储返回值
- JQuery和Ajax:如何在变量中存储返回的数据
- ExtJS GET操作在FireFox中存储返回值500
- Phonegap本地存储返回空结果
- 函数,该函数从Firebase存储返回下载URL
- 如何在代码中使用延迟对象来存储返回到变量中的数据?