HTML:
<div ng-app = "" ng-controller = "personController">
<p>Persoon:
<select ng-model="persoon">
<option ng-repeat="person in persons">{{person.FirstName}} {{person.FamilyName}}</option>
</select>
</p>
<p>De geboortedatum van <b>{{persoon}}</b> is {{persoon.BirthDate}} en is dus 16 jaar</p>
</div>
<script>
function personController($scope,$http) {
var persons = "persons.txt";
var persoon = "";
$http.get(persons).then( function(response) {
$scope.persons = response.data;
});
}
</script>
JSON:
[
{
"FirstName" : "Harry",
"FamilyName" : "James",
"BirthDate" : "29-10-1920"
}
]
Display the BirthDate of the selected person from the dropdown list. Need help with making it work correctly, as I've tried various approaches without success. Any assistance would be greatly appreciated.