Angular 2 - EXCEPTION:TypeError:无法读取属性' isSkipSelf' of null browser_adapter.ts

时间:2016-05-11 14:40:56

标签: angular

全部!在从测试版12更新到RC1后,我正面临这个问题 - 而且我不知道发生了什么。有没有人有解决方案?

  

EXCEPTION:TypeError:无法读取属性' isSkipSelf'为null   browser_adapter.ts:88 EXCEPTION:错误:未捕获(在承诺中):TypeError:无法读取属性' isSkipSelf'为null   browser_adapter.ts:78 EXCEPTION:错误:未捕获(在承诺中):TypeError:无法读取属性' isSkipSelf' of nullBrowserDomAdapter.logError @ browser_adapter.ts:78BrowserDomAdapter.logGroup @ browser_adapter.ts:89ExceptionHandler.call @ exception_handler.ts:53(匿名函数)@ application_ref.ts:304schedulerFn @async.ts:131SafeSubscriber .__ tryOrUnsub @ Subscriber.ts:240SafeSubscriber .next @ Subscriber.ts:192Subscriber._next @ Subscriber.ts:133Subscriber.next @ Subscriber.ts:93Subject._finalNext @ Subject.ts:154Subject._next @ Subject.ts:144Subject.next @ Subject.ts:90EventEmitter.emit @ async.ts:117onError @ ng_zone.ts:138onHandleError @ ng_zone_impl.ts:90ZoneDelegate.handleError @ zone.js:327Zone.runGuarded @ zone.js:233_loop_1 @ zone.js:487drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone .js文件:426   browser_adapter.ts:78 STACKTRACE:BrowserDomAdapter.logError @ browser_adapter.ts:78ExceptionHandler.call @ exception_handler.ts:56(anonymous function)@ application_ref.ts:304schedulerFn @async.ts:131SafeSubscriber .__ tryOrUnsub @ Subscriber.ts:240SafeSubscriber.next @ Subscriber.ts:192Subscriber._next @ Subscriber.ts:133Subscriber.next @ Subscriber.ts:93Subject._finalNext @ Subject.ts:154Subject._next @ Subject.ts:144Subject.next @ Subject.ts:90EventEmitter.emit @async .ts:117onError @ ng_zone.ts:138onHandleError @ ng_zone_impl.ts:90ZoneDelegate.handleError @ zone.js:327Zone.runGuarded @ zone.js:233_loop_1 @ zone.js:487drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js :426   browser_adapter.ts:78错误:未捕获(在承诺中):TypeError:无法读取属性' isSkipSelf'为null       at resolvePromise(zone.js:538)       在PromiseCompleter.reject(zone.js:515)       在eval(application_ref.ts:340)       在ZoneDelegate.invoke(zone.js:323)       at Object.onInvoke(ng_zone_impl.ts:67)       在ZoneDelegate.invoke(zone.js:322)       在Zone.run(zone.js:216)       在zone.js:571       在ZoneDelegate.invokeTask(zone.js:356)       at Object.onInvokeTask(ng_zone_impl.ts:56)BrowserDomAdapter.logError @ browser_adapter.ts:78ExceptionHandler.call @ exception_handler.ts:57(anonymous function)@ application_ref.ts:304schedulerFn @async.ts:131SafeSubscriber .__ tryOrUnsub @ Subscriber.ts :240SafeSubscriber.next @ Subscriber.ts:192Subscriber._next @ Subscriber.ts:133Subscriber.next @ Subscriber.ts:93Subject._finalNext @ Subject.ts:154Subject._next @ Subject.ts:144Subject.next @ Subject.ts:90EventEmitter .emit @ async.ts:117onError @ ng_zone.ts:138onHandleError @ ng_zone_impl.ts:90ZoneDelegate.handleError @ zone.js:327Zone.runGuarded @ zone.js:233_loop_1 @ zone.js:487drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js:426   zone.js:461未处理承诺拒绝:无法读取属性' isSkipSelf'无效;区域:角;任务:Promise.then;值:TypeError:无法读取属性' isSkipSelf' of null(...)consoleError @ zone.js:461_loop_1 @ zone.js:490drainMicroTaskQueue @ zone.js:494ZoneTask.invoke @ zone.js:426   zone.js:463错误:未捕获(在承诺中):TypeError:无法读取属性' isSkipSelf' of null(...)

4 个答案:

答案 0 :(得分:4)

看起来像这个问题https://github.com/angular/angular/issues/8519

  • 您可能需要更新管道transform()功能的参数列表
  • 您可能会错过配置中的emitDecoratorMetadata: true
  • 具有使用forwardRef()
  • 无法解决的循环依赖关系
  • 一些无法解决的导入
  • 在服务上遗失@Injectable()
  • ...

答案 1 :(得分:1)

此问题也在https://github.com/angular/angular/issues/8704

中报告过

如果您遇到以下情况:

组件A依赖于服务B,服务B依赖于服务C

解决方案是将 @Injectable()添加到服务B,并将服务B和C添加到组件A的提供者列表中。

(另一种解决方案是使用 @Inject(forwardRef(()=> ServiceC)在服务B的构造函数中向服务C添加forwardRef,并将服务B和C添加到组件A)的提供者列表

答案 2 :(得分:1)

对我来说,从提供商处取出localStorage:from   提供者:[HTTP_PROVIDERS,localStorage] 至   提供者:[HTTP_PROVIDERS]

解决了这个问题。我几乎可以肯定我目睹了它与localStorage一起工作的bug也许是海市蜃楼。

请确保您不要混淆指令:与提供商:

答案 3 :(得分:0)

我不确定为什么我的错误消失了,但是在我从我的服务构造函数中删除了参数并直接导入导入后,它工作了

import {blindMen} from '../elephant'
...
export class ElephantComponet{
blindMen:any;
constructor(){
this.blindMen = blindMen;
    }
}