Property 'subscribe' does not exist on type '() => Observable<any>'
You are not calling the getVideos
method. You are calling subscribe
on the function reference of getVideos
and not the returned value. Call subscribe
after you call getVideos()
:
ngOnInit() {
this.videoserv.getvideos().subscribe((response) => {
this.videos = response
});
}
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.