Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created October 5, 2017 04:04
Show Gist options
  • Save tkssharma/b3b5b3dcd4ed805d3f8ca4be6a7710bb to your computer and use it in GitHub Desktop.
Save tkssharma/b3b5b3dcd4ed805d3f8ca4be6a7710bb to your computer and use it in GitHub Desktop.
export default class Youtube implements OnInit {
Videos : video[];
loaded : boolean;
API_KEY : string;
selectVideo : video;
opts : any;
constructor() {
}
ngOnInit() {
this.loaded = false;
var params = {
part: 'snippet',
q: 'Still into You paramore',
maxResults: 5
}
client.search(params, (err:any, data:any) => {
// your magic..
console.dir(data);
this.Videos = data.items;
this.selectVideo = data.items[2]
this.loaded = true;
})
}
SearchValueChange(event:any){
this.loaded = false;
var params = {
part: 'snippet',
q: event.value,
maxResults: 5
}
client.search(params, (err:any, data:any) => {
// your magic..
console.dir(data);
this.Videos = data.items;
this.selectVideo = data.items[2]
this.loaded = true;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment