Currently working on a practice project where I am utilising the angular knowledge I have gathered and continue gathering through the online courses I am taking.
I am having a bit of trouble accessing a nested array. I saw an online tutorial and I have followed the basis of what was shown but I am obviously not doing something right. The code is shown below.
<div class="container">
<div class="classic-movie" ng-repeat="films in movies">
<div class="movie-summary">
<div class="movie-image">
<img ng-src="{{films.cover}}" class="movie-thumbnail">
</div>
<div class="movie-name-plot">
<h1>{{films.title}}</h1>
<p>{{films.plot}}</p>
<p><span class="white-mini-header">Starring:</span>{{films.starring}}</p>
<p><span class="white-mini-header">Runtime:</span>{{films.runtime}}</p>
</div>
</div>
<div class="movie-showtimes">
<ul class="movie-timing mon-timings" ng-repeat="timing movies.monTimings">
<li>{{timing.time1}}</li>
<li>{{timing.time2}}</li>
<li>{{timing.time3}}</li>
<li>{{timing.time4}</li>
<li>{{timing.time5}}</li>
<li>{{timing.time6}}</li>
</ul>
</div>
</div>
</div>
And below is a template of the first object in the array.
var myapp = angular.module("myapp", []);
myapp.controller("maincontroller", ["$scope", function($scope){
$scope.movies = [
{
cover: "images/movie-images/ferres.jpg",
title: "Ferris Bueller's Day Off (1987)",
plot: "High school student Ferris Bueller wants a day off from school and he's developed an incredibly sophisticated plan to pull it off. He talks his friend Cameron into taking his father's prized Ferrari and with his girlfriend Sloane head into Chicago for the day. While they are taking in what the city has to offer school principal Ed Rooney is convinced that Ferris is, not for the first time, playing hooky for the day and is hell bent to catch him out. Ferris has anticipated that, much to Rooney's chagrin.",
starring: "Matthew Broderick, Alan Ruck, Mia Sara",
runtime: "103min",
monTimings: [
{
time1: "10:45",
time2: "13:10",
time3: "15:45",
time4: "18:25",
time5: "20:30" ,
time6: "21:50",
}
]
},
When I go to the view, the list in which the timings are supposed to be displayed are not there at all.