Ionic localstorage

.factory(’$localstorage’, [’$window’, function ($window) {
return {
set: function (key, value) {
$window.localStorage[key] = value;
get: function (key, defaultValue) {
return $window.localStorage[key] || defaultValue;
setObject: function (key, value) {
$window.localStorage[key] = JSON.stringify(value);
getObject: function (key) {
return JSON.parse($window.localStorage[key] || ‘{}’);
remove: function(key) {

.controller(‘loginCtrl’, [’$scope’, ‘$http’, ‘$ionicPopup’,’$window’, ‘$localstorage’, function($scope, $http, $ionicPopup, $window, $localstorage) {
$scope.user = {};

$scope.login= function() {
	    $localstorage.setObject("val1", "1234");

$scope.logout = function(){

session remove not working…
Your prompt reply will be much appreciated

try this:

$timeout(function () {

$window.localStorage.clear(); will all other items that are stored for this app in local storage insted of that you may use $window.localStorage.removeItem(“val1”);

yeah you can try that one too… I just think he was logging out from the app so I think he wants to erase all in the local storage to refresh everything in the app… But either way is good which @baviskarmitesh says if you just want to clear specific local storage data…