【问题集】Error Cannot read property 'globals' of null
来源:互联网 发布:ubuntu autotools 编辑:程序博客网 时间:2024/05/29 14:08
问题:
在路由跳转的onEnter事件中,用到了$state.go()方法,运行时报Error Cannot read property 'globals' of null错误。解决办法:
为$state.go()方法增加一个延时,如下:
accountDevEdit: { url: '/account/auth/edit', template: accountDevEditTemplate, controller: accountDevEditController, sideMenu: "menuAccount", resolve: { isCreate: function(devService) { return devService.getDevInfo(baseConfig.baseUrl + "/dev/auth/getInfo") } }, onEnter: function(isCreate, $state, $timeout) { var timeoutId; if (!isCreate.data) { //未进行认证 timeoutId = $timeout(function() { $state.go('accountDevCreate'); $timeout.cancel(timeoutId); }, 10); } else { if (isCreate.status != 3) { //认证但非失败状态 timeoutId = $timeout(function() { $state.go('accountDev'); $timeout.cancel(timeoutId); }, 10); } } }}
解释说明:
Another solution for anyone facing this issue: as silly as it seems, try adding a $timeout around your transition from onEnter, if possible. The bug seems to occur due to processing a new transition during onEnter, so the $timeout will allow the original transition to complete before starting a new one, fixing the problem for me.
来源: https://github.com/angular-ui/ui-router/issues/326
阅读全文
0 0
- 【问题集】Error Cannot read property 'globals' of null
- easyui:Cannot read property 'nodeName' of null问题的解决
- Extjs4---Cannot read property 'addCls' of null
- Extjs4---Cannot read property 'addCls' of null
- extjs Cannot read property 'dom' of null
- Extjs4---Cannot read property 'addCls' of null
- extjs cannot read property 'addcls' of null
- Extjs4---Cannot read property 'addCls' of null
- Cannot read property 'root' of null 解决方法
- datagrid报Cannot read property '' of null
- Cannot read property 'getElementsByTagName' of null
- Cannot read property 'add' of null
- Extjs4---Cannot read property 'addCls' of null
- Cannot read property 'value' of null
- Qt:QML:Cannot read property '*' of null
- Cannot read property 'val' of null
- Cannot read property 'nodeName' of null
- Cannot read property 'glob' of null
- 2017多校第二场 HDU 6048 Puzzle 逆序数,脑洞题,结论题
- 杭电 OJ 1197 Specialized Four-Digit Numbers
- CSS 的浮动和清除
- spring扫描注解
- 浅谈用户密码保护与相关技术
- 【问题集】Error Cannot read property 'globals' of null
- Spring redis 分布式缓存详细说明、配置、
- TCP/IP协议总结(一)-TCP首部格式和TCP建立连接和释放连接
- RIP EIGRP OSPF 学习
- Factory模式
- 在linux虚拟机上部署MyEclipse上的javaWeb项目步骤
- C语言——实例007 输出特殊图案,请在c环境中运行
- C++虚函数实现原理
- 2017 多校2 1001 Is Derek lying?