属性 'pipe' 在类型 'void' 上不存在 Angular 6

Property 'pipe' does not exist on type 'void' Angular 6

我不明白问题的原因。 我的代码来自 Service 文件,但出现错误

  1. 属性 'pipe' 在类型 'void' 上不存在。
  2. 属性“$key”在类型“{}”上不存在。

https://i.imgur.com/0m0HmKi.png

import { Injectable } from '@angular/core';
import { AngularFireDatabase, AngularFireList } from '@angular/fire/database';
import { switchMap } from 'rxjs/operators';
import { Observable } from 'rxjs';
@Injectable({
  providedIn: 'root'
})
export class CoursesService {

  constructor(private af: AngularFireDatabase) { }

  findAllCourses(): AngularFireList<any> {
    return this.af.list('courses');
  }

  findCourseDtl(coursUrl:string){
   this.af.list('courses', ref => ref.orderByChild('url').equalTo(coursUrl)).valueChanges()
  }

  findLessonsForCours(coursUrl:string): Observable<any>{
    return this.findCourseDtl(coursUrl)
   .pipe(switchMap(course => this.af.list('lessonsPerCourse/'+ course.$key ).valueChanges()));


}

}

您没有 return findCourseDtl 函数中的任何值。

这可能是您想要的:

findCourseDtl(coursUrl:string){
  return this.af.list('courses', ref => ref.orderByChild('url').equalTo(coursUrl)).valueChanges()
}