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
    function(token) {'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");

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

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

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {

Many thanks for the help !