Javascript 保存文本框数据并从localstorage返回-angularJS-

Javascript 保存文本框数据并从localstorage返回-angularJS-,javascript,angularjs,scope,return,local-storage,Javascript,Angularjs,Scope,Return,Local Storage,当页面刷新时,我想将数据从范围返回到文本框值。我怎样才能只用“更新”按钮 示例:在plunker index.html中进行此更改 <script> angular.module("example", ["ngStorage"]) .controller("ExampleController", function($scope, $localStorage) { $scope.save = function() { $localStorage.message = $scope.

当页面刷新时,我想将数据从范围返回到文本框值。我怎样才能只用“更新”按钮


示例:

在plunker index.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>

angular.module(“示例”,[“ngStorage”])
.controller(“ExampleController”,函数($scope,$localStorage){
$scope.save=函数(){
$localStorage.message=$scope.zafer;
控制台日志(zafer);
}
$scope.load=函数(){
$scope.zafer=$localStorage.message;
} 
})
更新

在plunker index.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>

angular.module(“示例”,[“ngStorage”])
.controller(“ExampleController”,函数($scope,$localStorage){
$scope.save=函数(){
$localStorage.message=$scope.zafer;
控制台日志(zafer);
}
$scope.load=函数(){
$scope.zafer=$localStorage.message;
} 
})
更新

friend,在ios上不起作用。安卓正在工作。页面刷新时,返回数据。但ios不起作用。你知道为什么吗?朋友,在ios上不工作。安卓正在工作。页面刷新时,返回数据。但ios不起作用。你知道为什么吗?