Does not display the value by the key of the selected Json.
<select ng-model="selectedFaculty">
<option ng-repeat="faculty in faculties" value="{{faculty}}">{{faculty.Name}}</option>
</select>
<h1>Selected faculty: {{selectedFaculty}}</h1>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.faculties=[{Id:1,Name:'Economics'},{Id:2,Name:'IT'},{Id:3,Nam e:'Tourism'}];
});
</script>
If I will put selectedFaculty.Name instead of selectedFaculty then nothing is displayed in the page.
How can this be explained?
|