When I logged in, I stored the username in localStorage and wanted to verify the permissions based on localStorage information in stateChangeStart. However, I injected $localStorage in the run method and could not get the value of $localStorage. The page would report an error, $localStorage As undefined, what's going on?
漂亮男人2017-05-15 17:13:05
localStorage is a property under window, not angularJS. So there is no need to inject it, just use it directly
if( window.localStorage ){
//do sth...
}
For details, please refer to:
https://developer.mozilla.org...