How do I assign default ngOptions
through parent/child models?
In this question OP shows a way form parent/child relationships using <
The blank item is caused by the empty model value. You can try to put the following code at the end of the controller. The trick is to initialize site, building and floor when the page is loaded as well as when the site value is changed. Hope it helps.
$scope.selected = {
site: $scope.data[0],
building: $scope.data[0].buildings[0],
floor: $scope.data[0].floors[0]
};
$scope.$watch('selected.site', function () {
console.log($scope.selected.site);
$scope.selected = {
site: $scope.selected.site,
building: $scope.selected.site.buildings[0],
floor: $scope.selected.site.floors[0]
};
});