Please see my plunkr below
https://plnkr.co/edit/8xjmL9?p=preview
This what my $scope.data looks like
$scope.data = [
{
"projectedStart":"2016-12-14T00:00:00"
},
{
"projectedStart":"2017-01-04T00:00:00"
},
{
"projectedStart":"2017-01-11T00:00:00"
}
];
This is what my scope.possibleDates look like
$scope.possibleDates = [
{
"projectedStartDate":"2016-12-07T00:00:00",
"dateName":"December - Week 1"
},
{
"projectedStartDate":"2016-12-14T00:00:00",
"dateName":"December - Week 2"
},
{
"projectedStartDate":"2016-12-21T00:00:00",
"dateName":"December - Week 3"
},
{
"projectedStartDate":"2016-12-28T00:00:00",
"dateName":"December - Week 4"
},
{
"projectedStartDate":"2017-01-04T00:00:00",
"dateName":"January - Week 1 (20/10)"
},
{
"projectedStartDate":"2017-01-11T00:00:00",
"dateName":"January - Week 2 (20/10)"
}
]
This is what my select looks like which is obviously wrong
<table class="table table-bordered table-hover">
<thead>
<tr>
<th >Projected Date</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="d in data">
<td>
<select class="form-control"
ng-model="selectedValue"
ng-init="selectedValue = {{data.projectedStart == dates.projectedStartDate}}"
ng-options="dates.dateName for dates in possibleDates">
</select>
</td>
</tr>
</tbody>
</table>
I am trying to display a dropdown with a list of all the $scope.possibleDates's dateName property which is fine, but I want to have selected the value that matches with the 'projectedStart' in $scope.Data
ng-repeatstatement?