Search Posts

Category: local-storage

Best way to store token information in Angular JS

I am pretty confused with storing token information. Currently I am storing token information in Localstorage but the information remain even after closing the tab. Only during logout I am able to clear the token information from localstorage. But I want the token information to get cleared when following happened:- User accidentally close the browser(not tab) Browser crashed Browser closed from task manager I know that SessionStorage will be useful in such scenarios but Sessionstorage […]

Pass variables cross domain in angular js using cookies

I have a domain in which i am taking the username and password. Storing these in localstorage or cookies. Once the user logs in I have a link in which once user clicks that its redirected to in another tab.Notice the domains are different. I want to make use of the variables I have set in for How can I achieve this in angular Js? Localstorage is not cross domain is […]

LocalStorage Setting Object Inside Array Ionic List

I am trying to use LocalStorage to store an array that contains objects. Right now the following code is returning an object on the console and not returning as an array. This means that my ion-list cannot read it. Is there any way around this and getting back the value as an array with my objects in the array? The object presentation contains multiple things such as ID, title, etc etc. I want to be […]

LocalStorage Causing White Screen And Errors With Then Function

I am using localstorage in my Ionic application to set promises, etc. I have done this method exactly in the past with pouchdb but had some issues so moving over to localstorage instead, I am running the following code and getting a white screen along with the following error. I am not sure where I am going wrong, can localstorage accept a .then function? I thought it would of been able but I don’t see […]

ngstorage’s $localStorage still available in angular after deleting browser data

I am using ngStorage for storing data in local storage. I am facing this weird issue where, when I am deleting the localstorage from the browser, my website’s user doesn’t get logged out on url change. Here’s the code that keeps the check whether the localstorage exists or not and then does the appropriate route: $rootScope.$on(‘$locationChangeStart’, function (event, next, current) { //it always by passes this if (!$localStorage.currentUser) { $location.path(‘/login’); } }); Only when I […]

LocalStorage + AngularJS + $http Como retornar dados armazenados em array de objetos

Primeiramente, boa noite. Estou armazenando informações dentro de um localStorage através de um array de objetos. Preciso cadastrar cartões, e cada cartão cadastrado um conjunto de informações é armazenado no navegador como cvv, bandeira, nome, etc. É possível visualizar mais facilmente através da print abaixo. Minha necessidade é a seguinte: Quando eu for fazer um pagamento, devo selecionar um dos cartões armazenados e então, enviar para o destino através do método POST. Mas meu problema […]

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

Next Page »