Javascript 从$localstorage检索变量
我在和ngStorage合作。我试图做的是将搜索保存到本地存储,并在刷新表后将其检索回来。 这是我的简单代码: js html 我的功能根本不起作用。如果有人能解释我的错误,我将不胜感激Javascript 从$localstorage检索变量,javascript,jquery,angularjs,local-storage,bootstrap-table,Javascript,Jquery,Angularjs,Local Storage,Bootstrap Table,我在和ngStorage合作。我试图做的是将搜索保存到本地存储,并在刷新表后将其检索回来。 这是我的简单代码: js html 我的功能根本不起作用。如果有人能解释我的错误,我将不胜感激 ,您可以将localstorage中的值放入搜索bs表,但它不会触发。$scope.storage=$locastorage将整个$localstorage对象分配给变量。我不认为这是你想做的 要读取$localstoragedo的特定变量 $scope.storage.text = text; 此外,te
,您可以将localstorage中的值放入搜索bs表,但它不会触发。
$scope.storage=$locastorage
将整个$localstorage
对象分配给变量。我不认为这是你想做的
要读取$localstorage
do的特定变量
$scope.storage.text = text;
此外,text.push($scope.storage)
不会将任何内容分配给$scope.storage
myarray.push(myvar)
将myvar
添加到myarray
将某物放入$scope.storage
执行以下操作
$scope.storage.text = text;
$scope.storage=text
$scope.storage.mykey=text
$scope.storage=$locastorage
将整个$localstorage
对象分配给变量。我不认为这是你想做的
要读取$localstorage
do的特定变量
$scope.storage.text = text;
此外,text.push($scope.storage)
不会将任何内容分配给$scope.storage
myarray.push(myvar)
将myvar
添加到myarray
将某物放入$scope.storage
执行以下操作
$scope.storage.text = text;
$scope.storage=text
$scope.storage.mykey=text
$scope.data = $scope.storage.text
而不是检索文本
将文本保存到本地存储器的步骤
$scope.data = $scope.storage.text
而不是检索文本
它返回:
TypeError:$scope.storage.push不是一个函数
似乎是正确的。我做了一些阅读:$scope.storage=$localstorage将整个本地存储推送到这个变量中。请尝试$scope.storage=text
它返回:TypeError:$scope.storage.push不是一个函数
似乎是正确的。我做了一些阅读:$scope.storage=$localstorage将整个本地存储推送到这个变量中。请尝试$scope.storage=text
文本正在检索,问题是我无法将此文本推回搜索是否尝试了text.push($scope.storage.text);如果我使用$scope.storage.text,它会告诉我文本未定义。是否将文本保存到storage.text?你必须保存文本才能加载它,我的搜索代码是什么意思?它是bs表格的一部分,并通过此函数内的text
(“#table”).on('search.bs.table',函数(e,text){})代码>您可以找到文本正在检索的搜索值,问题是我无法将此文本推回搜索您是否尝试了text.push($scope.storage.text);如果我使用$scope.storage.text,它会告诉我文本未定义。是否将文本保存到storage.text?你必须保存文本才能加载它,我的搜索代码是什么意思?它是bs表格的一部分,并通过此函数内的text
(“#table”).on('search.bs.table',函数(e,text){})代码>您可以找到搜索值