I'm trying to show the data from my angular controller based on a specific value, which in this case is the days of the week. Here is my controller:
app.controller("ExerciseCtrl", function($scope){
var exercise_arr = [
{
name: "Bicep Curl",
weight: 30,
day: "Monday"
},
{
name: "Bench Press",
weight: 140,
day: "Tuesday"
},
{
name: "Squats",
weight: 140,
day: "Thursday"
}
];
$scope.exercises = exercise_arr;
});
Now in my HTML, I will have a tab for each day of the week. How do I go about only showing the controller data's day with the corresponding tab for the day of the week?
<ul class="nav nav-pills">
<li><a href="#">Sunday</a></li>
<li><a href="#">Monday</a></li>
<li><a href="#">Tuesday</a></li>
<li><a href="#">Wednesday</a></li>
<li><a href="#">Thursday</a></li>
<li><a href="#">Friday</a></li>
<li><a href="#">Saturday</a></li>
</ul>
<div ng-controller="ExerciseCtrl">
<ul ng-repeat="exercise in exercises">
<li>
{{exercise}}
</li>
</ul>
</div>
So what I want in the end is that when I click on the Monday tab, I only want the controller data that has the day value of Monday, etc. Thanks in advance for the help!
<ul>in the controller you can do something like this