当我将值推送到 localstorage 时,我从 firebase 获得了价值 empty srting is push how to fix it
我的代码:
var app = angular.module("bucksbucketapplication", ['firebase', 'ngStorage']);
app.controller("bucksbucket_orders", function ($scope, $firebaseArray, $firebaseObject, $http, $localStorage) {
var fbvalues = new Firebase("https://qwertyuiop.firebaseio.com/values");
$scope.syncfromfbvalues = $firebaseArray(fbvalues);
$scope.$storage = $localStorage.$default({
"orders": []
});
$scope.data = $localStorage.orders;
$scope.cloneItem = function (syncfromfbvalues) {
$scope.$storage.orders.push({
"price": syncfromfbvalues.id
});
}
});
并在我的结束代码前面:
<html ng-app="bucksbucketapplication">
<head>
<script src="angular.min.js"></script>
<script src="firebase.js"></script>
<script src="angularfire.min.js"></script>
<script src="ngstr.js"></script>
<script src="script.js"></script>
</head>
<body ng-controller="bucksbucket_orders">
<li ng-repeat="message in syncfromfbvalues">{{message.greens}} <button class="btn btn-primary" data-ng-click="cloneItem(syncfromfbvalues)">to local</button></li>
</body>
</html>