Search Posts

Category: angular-local-storage

How to display sum of values in local-storage with same username only?

I have local-storage values in below : [ {“id”:1, “amount”:24000000, “users”:{“username”:”user1″}}, {“id”:2, “amount”:10000000, “users”:{“username”:”user1″}}, {“id”:3, “amount”:20000000, “users”:{“username”:”user2″}} ] I display my local-storage in JSP using AngularJS. How to sum amount values in local-storage with same username only?. My controller : $scope.listOfCart = CartService.getAllCarts()||[]; $scope.items = $scope.listOfCart My JSP: <tr data-ng-repeat=”cart in items”> <td>{{cart.users.username}}</td> <td>{{cart.amount}}</td> </tr> Then how to display sum values amount with same username only? I try with forEach but display all amount username. […]

How to display sum of values in local-storage?

I have local-storage values in below : [{“id”:1, “amount”:24000000}, {“id”:2, “amount”:10000000}] How to sum amount values in local-storage?. I display my local-storage in jsp using AngularJS. My controller : $scope.listOfCart = CartService.getAllCarts()||[]; $scope.items = $scope.listOfCart My jsp : <tr data-ng-repeat=”cart in items”> <td>{{cart.amount}}</td> </tr> Then how to display sum values amount? Source: AngularJS

Localstorage is working for first time. If I refresh page at second it is working fine

Am using Angular ng-storage. Am facing an issue with local storage. At first when page is loaded the localstorage is assigning with null value. If I refresh at second time localstorage value is setting fine. I dono what the issue. My code is. var app = angular.module(‘EntityApp’, [‘ngRoute’,’slickCarousel’]); app.controller(‘EntityAppCntroller’, function ($scope, $http, $window) { localStorage.IsNewPinSet = 22; if (localStorage.getItem(‘IsNewPinSet’) != 1) { var getLocation = function() { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { alert(“Geolocation […]