I am trying to return an array from a function once onClick is triggered. I see the values contained in the array in the console. But I don't see the values displayed on the HTML page.
The Controller:
$scope.chosenFilm = []; //The array where values are stored
//onClick function
$scope.insertFilm = function () {
console.log("Film saved in watch list!");
getSelectedFilm(); //Call function
}
function getSelectedFilm() {
return $http.get('/watch-list').then(function(response) {
$scope.chosenFilm = response.data;
$log.info($scope.chosenFilm[0]); // Values displayed in console!
return $scope.chosenFilm;
});
}
HTML Page where values would be displayed:
<div class="container">
<table class="table">
<thead>
<tr>
<th>Film</th>
<th>Poster</th>
<th>Overview</th>
<th>Genres</th>
<th>Release</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="film in chosenFilm">
<td>{{film.title}}</td>
<td><img ng-src="{{film.poster}}"></td>
<td>{{film.overview}}</td>
<td>{{film.genres}}</td>
<td>{{film.release | date: "dd.MM.y" : UTC+00:00 }}</td>
</tr>
</tbody>
</table>
</div>