AngularJS Session Storage ngStorage

Today, We want to share with you AngularJS Session Storage ngStorage.
In this post we will show you AngularJS Session Storage ngStorage, hear for AngularJS Session Storage ngStorage we will give you demo and example for implement.
In this post, we will learn about AngularJS Session Storage ngStorage with an example.

step by step example of Save data and Retrieve data from (javascript)HTML5 LocalStorage using and SessionStorage using AngularJS example

There are following list of Contains two services: 1) $localStorage 2) $sessionStorage.
sessionStorage – you got all this always-overlooked buddy data covered.

LocalStorage and SessionStorage made easy in AngularJs Example

index.html

<header>
    <div class="title">:#/infinityknow</div>
    www.infinityknow.com
<hr />
    Session Storage Example with AngularJS
</header>
<div id="container">
  Hello, {{message}}!
</div>

App.js

var liveApp = angular.module('liveApp',[]);

function liveCtrl($scope,$window) {
   
    //Same as Cookies SAVE VAUE
    $window.sessionStorage.setItem("tableRkey","I'm a value (infinityknow.com) saved with SessionStorage");
    
    //Same as Cookies RETRIEVE VALUE
    $scope.message = $window.sessionStorage.getItem("tableRkey");
    
}

Style.css

header{
    font-size:30px;
    text-align:center;
    margin:30px;
    padding:10px;
}

.title{
    font-size:40px;
    color:green;
}

#container{
    text-align:center;
    margin:10px;
    padding:30px;
}

angularjs ngstorage example

ngStorage using | localStorage and sessionStorage done all the right for AngularJS

READ :  Vuejs Introduction Architecture Advantages - VueJs Examples



  
    <a href="http://angular.min.js">http://angular.min.js</a>
    <a href="http://ngStorage/master/ngStorage.js">http://ngStorage/master/ngStorage.js</a>
    
    
      angular.module('liveApp', [
        'ngStorage'
      ]).
      
      controller('liveCtrl', function(
        $scope,
        $localStorage
      ){
        $scope.$storage = $localStorage.$default({
          x: 41
        });
      });
    
  

  
	<h1>AngularJS Session Storage Example - ngStorage</h1>
    <button>{{$storage.x}}</button> + <button>{{$storage.y}}</button> = {{$storage.x + $storage.y}}
  



Example

Example

We hope you get an idea about AngularJS Session Storage ngStorage
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.