Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

  1. Property 'pipe' does not exist on type 'void'.
  2. Property '$key' does not exist on type '{}'.

enter image description here

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()));


}

}
like image 420
JetBro Avatar asked Sep 05 '25 20:09

JetBro


1 Answers

You didn't return any value in the findCourseDtl function.

This may be what you intended:

findCourseDtl(coursUrl:string){
  return this.af.list('courses', ref => ref.orderByChild('url').equalTo(coursUrl)).valueChanges()
}
like image 136
zmag Avatar answered Sep 09 '25 15:09

zmag