Search Posts

Category: local-storage

localStorage value doesn’t want to be set

I have problem with set values in localStorage. I use AngularJS and Electron. When I update refreshTime, values for errors and opacity are set to null. Why? $scope.storageLang = localStorage.getItem(“language”); $scope.storageMonitors = localStorage.getItem(“monitors”); $scope.storageAlarm = localStorage.getItem(“alarm”); $scope.storageErrors = localStorage.getItem(“errors”); $scope.storageDomain = localStorage.getItem(“domain”); $scope.storageOpacity = localStorage.getItem(“opacity”); $scope.refreshTime = localStorage.getItem(“refreshTime”); $scope.submit = function($event) { $event.preventDefault(); localStorage.setItem(“domain”, $scope.storageDomain); localStorage.setItem(“language”, $scope.storageLang); localStorage.setItem(“monitors”, $scope.storageMonitors); localStorage.setItem(“alarm”, $scope.storageAlarm); localStorage.setItem(“errors”, $scope.storageErrors); localStorage.setItem(“opacity”, $scope.storageOpacity); localStorage.setItem(“refreshTime”, $scope.refreshTime); }; In HTML all my inputs has ng-model=”storageLang” […]

How to logout when my token is expired and unauthorized?

The below code is my service.js.How to log out when my token is expired and unauthorized? Do we need to set local storage? can someone help me or suggest me how can I achieve the result which I’m looking for.Thanks in Advance ‘use strict’; angular.module(‘Authentication’) .factory(‘AuthenticationService’, [‘Base64’, ‘$http’, ‘$cookieStore’, ‘$rootScope’, ‘$timeout’, function (Base64, $http, $cookieStore, $rootScope, $timeout) { var service = {}; service.Login = function (callback) { //authenticate data http $‘’) .then(function (response) { callback(response); […]

About AngularJS pagination (I used localStorageService before but it wasn’t the solution i wanted to apply)

First, Thank you for watching this question! I’m newbie to angularJS and i’m trying to make pagination to be more flexible to use. Below is my situation. I made pagination function It works as my intention But, When i get into other page(leave list page which includes pagination function), and try to go back, the problem appears! (Here is what i want to solve) I go back to list page by clicking backspace key or […]

AngularJS – Json with LocalStorage doesn’t update Array

I have a form in a View that should update the “color” property of an Array. This Array colors has 5 objects, each serving to set the color of an element of another View (so the option to use localStorage, since I can not use any access to the server, like $http). The form view (settings.html) <form name=”colorform” class=”row col-md-offset-1″ ng-submit=”update(key)”> <div class=”col-md-6″> <div class=”form-group”> <label>Color A (Tiles)</label> <input name=”main” ng-model=”colors[0].color” class=”form-control”> </div> <div class=”form-group”> […]

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 […]

Use condition with two for values

I wanna use show / hide div function with localStorage. So I wrote this code scope: function getLocalDatas (clickedBefore, data, nid, vote, advpoll_choice, title, element) { for(var nid in actualPolls){ var nids = []; var nids = JSON.stringify(actualPolls[nid].nid); // console.log(‘id ‘+ ids); console.log(‘here ‘+ nids); } for(var i in localStorage){ var ids = JSON.stringify(localStorage[i]); // console.log(‘id ‘+ ids); console.log(‘nid ‘+ ids); } if(ids == nids) { console.log(‘ids ‘+ids); vm.clickedBefore = true; console.log(vm.clickedBefore); console.log(“done”); } else […]

How to use localStorage value filter in ng-repeat

I’ve set a value when the user click vote choice. Its working. .then(function(response) { localStorage.setItem(‘isClicked’, ‘Yes’); var i = +localStorage.key(“nid”); var nidId = ‘nid’ + localStorage.length; localStorage.setItem(nidId, vm.nid); vm.clickedBefore = true; }) This is my HTML scope: <div class=”card myfunc” ng-repeat=”myfunc in myfuncPage.myfuncs” id=”{{myfunc.nid}}” > <div class=”item item-text-wrap”> <h2 class=”item-icon-left”><i class=”icon ion-ios-analytics”></i> {{myfunc.title}}</h2> </div> <div class=”item item-text-wrap” ng-show=”localstorage”> <img ng-src=”{{myfunc.field_image.und[0].imgPath}}”/> <p class=”custom-class” ng-bind-html=’myfunc.body.und[0].value’> </p> <ul ng-repeat=”vote in myfunc.advmyfunc_choice”> <li ng-repeat=”voteselect in vote”> <div class=”row”> <button […]