错误TypeError:无法读取未定义的属性'get'

具有

在此处输入图片说明错误TypeError:无法读取未定义的属性'get'

我在角度上是新的,我真的需要帮助,在此先感谢

constructor(private http: Http, private authService: AuthService, private router: Router) {
	this.token = localStorage.getItem('token');
	
	if(token){
		this.interval = setInterval(this.ingameee, 5000);
	}
}

ingameee() {
   this.http.get('http://url.com/api/matchmaking/keepalive?token='+ this.token)
          .subscribe(
              response => {
                  this.dataa = response;
                  this.mod = this.dataa.json().mod;
                  this.playersinqueue = this.dataa.json().playersinqueue;
                  this.region_id = this.dataa.json().region_id;
                  this.party_id = this.dataa.json().party_id;
                  },
              error => console.log(error),
          );

  }

蓬伊

请记住arrow function在使用回调时用于保留上下文,因为this(上下文)会发生变化。

this.interval = setInterval(() => this.ingameee(), 5000);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

TypeError:无法读取未定义的Angular.js的属性“ get”

邮递员测试引发“ TypeError:无法读取未定义的属性'get'”

FormGroup错误TypeError:无法读取未定义的属性“ get”

TypeError:无法读取未定义的Ionic 3 / Angular 5的属性“ get”

角度测试和HttpClient:TypeError:无法读取未定义的属性“ get”

Angular6-FormControlName-TypeError:无法读取未定义的属性“ get”

我收到“ Uncaught TypeError:无法读取未定义的属性'get'”

TypeError:无法读取未定义的属性“ get”(固定的冲突导入无法正常工作)

WebDriverWait.until-JavaScript错误:无法读取未定义的属性“ get”

Discord.js TypeError:无法读取未定义的属性“ get”

TypeError:无法使用useEffect和Axios读取未定义的属性“ get”

TypeError:无法读取未定义的属性“ get”-Vue资源和Nuxt

“ TypeError:无法读取未定义的属性'get'”,Axios,Vue.JS

VueComponent。mount:TypeError:无法读取已安装的挂钩中未定义的属性“ get”

TypeError:无法读取未定义的guild.roles的属性“ get”

TypeError:无法在> ServerResponse.json中读取未定义的属性“ get”?

discord.js反应TypeError:无法读取未定义的属性“ get”

AngularJS类型错误:无法读取未定义的属性“ GET()”

即使注入http之后,也会出现Uncaught TypeError:无法读取未定义的属性'get'

TypeError:无法读取AngularJS上未定义的属性“ get”

TypeError:无法读取未定义的属性“ get”(Node.js)

Wordpress 编辑器 JS 错误“TypeError:无法读取未定义的属性‘get’”

类型错误:无法读取未定义的 vue js 的属性“get”

角度:错误:formGroup 需要一个 FormGroup 实例。无法读取未定义的属性“get”

BackboneJS 视图 - 未捕获的类型错误:无法读取未定义的属性“get”

我收到错误,如“无法读取未定义的属性‘get’”。如何解决这个问题?

类型错误:无法读取 Express 上未定义的属性“get”

开玩笑错误-无法读取未定义的属性“get”

离子存储:类型错误:无法读取未定义的属性“get”