brandly / angular-youtube-embed

:tv: Embed a YouTube player with a simple directive
http://brandly.github.io/angular-youtube-embed/
MIT License
510 stars 147 forks source link

Videos repeat on ng-repeat. #55

Closed Pantheon1994 closed 9 years ago

Pantheon1994 commented 9 years ago

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" } ]

brandly commented 9 years ago

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! :star2: