【发布时间】:2018-06-15 13:08:56
【问题描述】:
我正在关注英雄官方教程。
我在hero.service.ts收到一个问题,功能是使用HTTP PUT方法更新新英雄。
如下代码:
/** PUT: update the hero on the server */
updateHero(hero: Hero): Observable<any> {
return this.http.put(this.heroesUrl, hero, httpOptions).pipe(
tap(_ => this.log(`updated hero id=${hero.id}`)),
catchError(this.handleError<any>('updateHero'))
);
那么_在代码中的含义是什么?
【问题讨论】:
-
它只是将单个参数命名为箭头函数
_,大概是为了按照惯例表明他们实际上不会在函数中使用该参数。
标签: angular typescript