service file
import { Observable } from \'rxjs/Rx\';
import { Http,Response} from \'@angular/http\';
import { Injectable } from \'@angular/core\';
import \'
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.
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
});
}