Save the device token into localstoarge

I am using Pushwoosh + ionic1 to do the push, I would like to use their API to do individual push, so I need to save the device token in my database.

I can get the device token, however, I don’t know how to save it into localstarge. Or how can I call to get the device token in other controller with local storage enable ? The code is as below :

In APP.js

function onPushwooshInitialized(pushNotification) {

  //if you need push token at a later time you can always get it from Pushwoosh plugin
  pushNotification.getPushToken(
    function(token) {
      console.info('push token: ' + token);
      $localStorage.pushwooshHWID = token; // it can’t save to localStorage as local storage is not defined here.
      
    }
  );
}

function initPushwoosh() {
  var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");

 pushNotification.registerDevice(
    function(status) {
      alert("registered with token: " + status.pushToken); // I can register and get the token
      onPushwooshInitialized(pushNotification);
      
    }
}

angular.module('App', ['ionic', 'ngStorage','ngCordova','ngCordovaOauth' ,'starter.controllers','ngSanitize', 'srfSocialSharing','ui.router','btford.socket-io'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
initPushwoosh();
});
})

Many thanks for the help !