vendredi 8 mai 2015

Why is my ng-repeat acting like the object is empty?

Here is my controller code:

// Called automatically with the response of the YouTube API request.
window.onSearchResponse = function(response) {
    console.log(response); //Shows entire response data
    console.log(response.items[0].snippet.title); //shows video title
    console.log(response.items[0].id.videoId); //shows video Id
    console.log(response.items[0].snippet.thumbnails.medium.url); //shows video thumbnail
    $scope.videos = response.items;
    console.log($scope.videos); //This outputs an object with 5 Objects in it. Proof that the API is picking up something.
};

}]);

And here is the partial:

<ul>
    <li ng-repeat="video in videos">
    hey
    </li>
</ul>

Since i'm using the youtubeAPI, every search result brings back 5 results. console.log($scope.video) shows in the console the 5 objects, so I know it's being populated.

However whenever I go to my partial page and inspect element, the tags are completely empty. like the ng-repeat never ran.

Why would it not run? I should be seeing "hey" 5 times.

Aucun commentaire:

Enregistrer un commentaire