如何控制台记录我的api搜索结果

我正在遵循使用typeahead提供的angular提供的示例-在此处找到:https://ng-bootstrap.github.io/#/components/typeahead/examples

我想看看响应中返回了什么,但是我不确定如何解决它。

我尝试将console.log放入管道中,并尝试在地图中进行操作,但这不是正确的方法。我对管道和地图不是很熟悉,因此不胜感激。

在下面的代码中,我想知道来自Wiki api的响应是什么,然后如何将其返回给搜索功能。

/// this is where i want to know what is being returned.
return this.http
      .get(WIKI_URL,{params: PARAMS.set('search',term)}).pipe(
        map(response => response[1])
      );

// Where does this receive the above response and how is it doing the typeahead.

search = (text$: Observable<string>) =>
    text$.pipe(
      debounceTime(300),distinctUntilChanged(),tap(() => this.searching = true),switchMap(term =>
        this._service.search(term).pipe(
          tap(() => this.searchFailed = false),catchError(() => {
            this.searchFailed = true;
            return of([]);
          }))
      ),tap(() => this.searching = false)
    )

如果我在搜索框中搜索“ ja”,它将提供一个以“ ja”开头的所有结果的下拉列表,这是正确的,也是我最终想要实现的结果,但是需要知道返回什么才能执行此操作。

我希望这是有道理的。非常感谢您的帮助。

谢谢。

shao__fei 回答:如何控制台记录我的api搜索结果

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3167730.html

大家都在问