属性'pipe'在any类型上不存在[] |观察<对象>

时间:2019-01-19 16:27:02

标签: angular

我正在尝试使用'ng build --prod'进行构建。但是我收到了

之类的错误
  

any []类型不存在属性管道。

组件代码:

search = (text$: Observable<string>) =>

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

查看代码:

<input id="typeahead-http" type="text" class="form-control" placeholder="Enter Product Name" 
 #input
(selectItem)="selectedItem($event,input)"
[class.is-invalid]="searchFailed"
[(ngModel)]="model" 
[ngbTypeahead]="search"
[inputFormatter]="formatter"
[resultFormatter]="formatter"  />
<span *ngIf="searching">searching...</span>
<div class="invalid-feedback" *ngIf="searchFailed">Sorry, this product could not be loaded.</div>

0 个答案:

没有答案