How do I pass $scope.video_url
to a javascript function in my view?
I have a service that returns me the id of a video, and in my view I have a javascript infonation that starts the youtube player according to this id, but how do I pass that id to the function? >
I created a service, but the video did not appear in my view.
myApp.service('youtubeAPI',function(){
return({
showMovie:movieYoutube,
});
function movieYoutube( video_url ){
var player, iframe;
// init player
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '200',
width: '342',
videoId: video_url,
events: {
'onReady': onPlayerReady,
}
});
}
// when ready, wait for clicks
function onPlayerReady(event) {
var player = event.target;
player.playVideo();
}
}
});