我在登录的时候把用户名存在localStorage中,想在stateChangeStart中根据localStorage的信息验证权限,可是我在run方法中注入$localStorage中获取不到$localStorage的值,页面会报错,$localStorage为undifined,这是怎么回事?
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...
localStorage is a property under window, not angularJS. So there is no need to inject it, just use it directly
For details, please refer to:
https://developer.mozilla.org...