小编swe*_*tha的帖子

错误类型错误:无法读取 null 的属性“额外”

这是我的代码,我收到错误“ERROR TypeError: Cannot read property 'extras' of null ”

  ngOnInit() {
  const navigation = this.router.getCurrentNavigation();
  const state = navigation.extras.state as {
  api: string;
  trace_id: string;
  token_id: string;
  hotel_code: string;
  result_index: string;
  };
  this.reqObj = {
  api: state.api,
  trace_id: state.trace_id,
  token_id: state.token_id,
  hotel_code: state.hotel_code,
  result_index: state.result_index
    };
  }
Run Code Online (Sandbox Code Playgroud)

angular

3
推荐指数
1
解决办法
8558
查看次数

标签 统计

angular ×1