Property 'subscribe' does not exist on type '() => Observable'

前端 未结 2 1327
情深已故
情深已故 2020-12-30 02:08

service file

import { Observable } from \'rxjs/Rx\';
import { Http,Response} from \'@angular/http\';
import { Injectable } from \'@angular/core\';
import \'         


        
2条回答
  •  猫巷女王i
    2020-12-30 02:49

    ngOnInit() {
        this.videoserv.getvideos().subscribe((response) => {
             this.videos = response
        });
    }
    

    You should be calling the getvideos() method on the videoserv service. You were missing the (), getvideos is a method not a property.

提交回复
热议问题