[英]Property 'pipe' does not exist on type 'void' Angular 6
I don't understand the cause of the problem.我不明白问题的原因。 my code from
Service
File and i get Error我的
Service
文件中的代码,我得到错误
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()));
}
}
You didn't return any value in the findCourseDtl
function.您没有在
findCourseDtl
function 中返回任何值。
This may be what you intended:这可能是您的意图:
findCourseDtl(coursUrl:string){
return this.af.list('courses', ref => ref.orderByChild('url').equalTo(coursUrl)).valueChanges()
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.