Javascript 角度2错误TS1005:'应为','
我在编译时遇到这个错误 我找不到应该在哪里加逗号Javascript 角度2错误TS1005:'应为',',javascript,angular,typescript,Javascript,Angular,Typescript,我在编译时遇到这个错误 我找不到应该在哪里加逗号 src/app/navbar.component.ts(29,39): error TS1005: ',' expected. src/app/tache.service.ts(53,53): error TS1005: ',' expected. navbar.component.ts 服务台 我认为您不能通过参数传递数据类型: this.tacheService.insert( tache: Tache); 应该是 this.tacheS
src/app/navbar.component.ts(29,39): error TS1005: ',' expected.
src/app/tache.service.ts(53,53): error TS1005: ',' expected.
navbar.component.ts
服务台
我认为您不能通过参数传递数据类型:
this.tacheService.insert( tache: Tache);
应该是
this.tacheService.insert( tache );
JSON.stringifytache.stat:1无效。stringifytache.stat:1也是无效语法。实际上,您在参数和变量上注释类型,而不是在参数上注释类型。
this.tacheService.insert( tache: Tache);
this.tacheService.insert( tache );
this.tacheService.insert( tache: Tache); // the first error ( line 29)
this.tacheService.insert( tache); // No Error
return this.http
.put(this.tachesUrl, JSON.stringify(tache.stat:1), {
headers: this.headers
}) // second error ( line 53 )
.toPromise()
.then(() => tache)
.catch(this.handleError);
return this.http
.put(this.tachesUrl, JSON.stringify(tache.stat), {
headers: this.headers
}) // No Error
.toPromise()
.then(() => tache)
.catch(this.handleError);