I am trying to return an array from a function after running onClick . I see the values contained in the array in the console. But I do not see the values displayed on the HTML page.
Controller:
$scope.chosenFilm = [];
$scope.insertFilm = function () {
console.log("Film saved in watch list!");
getSelectedFilm();
}
function getSelectedFilm() {
return $http.get('/watch-list').then(function(response) {
$scope.chosenFilm = response.data;
$log.info($scope.chosenFilm[0]);
return $scope.chosenFilm;
});
}
HTML page where the values will 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>
source
share