brandly / angular-youtube-embed

:tv: Embed a YouTube player with a simple directive

Home Page:http://brandly.github.io/angular-youtube-embed/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Videos repeat on ng-repeat.

Pantheon1994 opened this issue · comments

I have a json file where I save my videos when I execute a ng-repeat I'd which each one of his videos have a different scope of player-vars. Is that possible?

Json files :
[
{
"id": "0",
"title": "Lorem ipsum torem tapusm ipsum",
"date": "19 juillet 2015",
"videosUrl": "zFXpNT-Tse0",
"startTimes": "40",
"endTimes": "45",
"herosId": "5",
"likes": "45",
"comments" : "384"
},
{
"id": "1",
"title": "Lorem ipsum torem tapusm ipsum",
"date": "19 juillet 2015",
"videosUrl": "zFXpNT-Tse0",
"startTimes": "5",
"endTimes": "10",
"herosId": "5",
"likes": "45",
"comments" : "384"
}
]

that should work fine. you could have an array of objects like

$scope.videos = [{
  id: 'zFXpNT-Tse0',
  vars: {
}, ....]

and then just

<div ng-repeat="video in videos">
  <youtube-player video-id="video.id" player-vars="video.vars"></youtube-player>
</div>

you get a new scope inside each iteration of an ng-repeat so you should have no trouble

let me know if you get it working! 🌟