brandly / angular-youtube-embed

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

Not works video-id with Ionic #117

Closed cristianchaparroa closed 8 years ago

cristianchaparroa commented 8 years ago

Hello I'm trying to use it with Ionic and I've a problem with video-id , when I see the source code, I see the name of variable not the value.

screen shot 2016-04-22 at 4 33 39 pm

So this is my view:

     <ion-list ng-controller="ListController as vm">

         <ion-item ng-repeat="video in vm.videos">
           {{video.title}}
           <div class="item item-thumbnail-left">
                <youtube-video class="embed-responsive-item" video-id="video.videoId" ></youtube-video>
           </div>
         </ion-item>
       </ion-list>

And this is my controller:

(function(){
  'use strict';

  angular
        .module('app')
        .controller('ListController', ['videoService',ListController]);

  function ListController(videoService) {
    var vm = this;

    vm.videos = [];

    loadVideos();

    function loadVideos() {
        return getVideos().then(function(){
          console.log('loading videos...');
        });
    }

    function getVideos() {
      return videoService.getVideos().then(function(data){
        vm.videos  = data;
        return vm.videos;
      });
    }
  }

})();

The vm.videos look like:

{"1G4isv_Fylg":{"videoId":"1G4isv_Fylg","title":"Coldplay - Paradise (Official Video)",
      "urlThumbnails":"https://i.ytimg.com/vi/1G4isv_Fylg/hqdefault.jpg",
      "urlEmbed":"www.youtube.com/embed/1G4isv_Fylg"},
  "YykjpeuMNEk":{"videoId":"YykjpeuMNEk","title":"Coldplay - Hymn For The Weekend (Official video)",
        "urlThumbnails":"https://i.ytimg.com/vi/YykjpeuMNEk/hqdefault.jpg",
        "urlEmbed":"www.youtube.com/embed/YykjpeuMNEk"}
}

What am I doing wrong?