title: angular - local storage not working
body: <p>I am trying to store data in local storage when the app loads using the AngularJS ngStorage module.</p>
  
  <p>I have the following code:</p>
  
  <p><strong>app.js:</strong></p>
  
  <pre><code>angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives', 'ngCordova', 'ngStorage'])
  
  .run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      if(window.cordova &amp;&amp; window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      }
      if(window.StatusBar) {
        // org.apache.cordova.statusbar required
        StatusBar.styleDefault();
      }
  
      $localStorage.message = "Hello World";
  
    });
  })
  </code></pre>
  
  <p>Then using my controller, I want to do the following.</p>
  
  <p><strong>controller.js:</strong></p>
  
  <p><code>$scope.data = $localStorage.message;</code></p>
  
  <p>and finally output the saved message.</p>
  
  <p><strong>message.html</strong></p>
  
  <p><code>&lt;div&gt;&lt;p&gt; Saved Message:{{ data}} &lt;/p&gt;&lt;/div&gt;</code></p>
  
  <p>When I check the local storage using Chrome Inspect tool, I dont see the stored message. Any idea how to save data from app.js at startup?</p>