Taking the concept of what was being asked here, and using this code:
markup:
<div ng-app="myApp" ng-controller="BookingCtrl">
<select ng-model="selected.site" ng-options="s.data as s.site for s in data">
<option value="">-- Site --</option>
</select>
<select ng-model="selected.building" ng-options="b.data as b.building for b in selected.site.buildings">
<option value="">-- Building --</option>
</select>
<select ng-model="selected.floor" ng-options="f.data as f.floor for f in selected.site.floors">
<option value="">-- Floor --</option>
</select>
javascript:
var myApp = angular.module( 'myApp', [] );
myApp.controller( 'BookingCtrl', ['$scope', '$location', function ( $scope, $location ) {
$scope.selected = {};
$scope.data = [
{
"id" : "0",
"site" : "Brands Hatch",
"data" : 0,
"buildings" : [
{ "building" : "Building #1", "data":1},
{ "building" : "Building #2", "data":2 },
{ "building" : "Building #3", "data":3 }
],
"floors" : [
{ "floor" : "Floor #1", "data":1 },
{ "floor" : "Floor #2", "data":2 },
{ "floor" : "Floor #3", "data":3 }
]
},{
"id" : "1",
"site" : "Silverstone",
"data" : 1,
"buildings" : [
{ "building" : "Building #4", "data":1 },
{ "building" : "Building #5", "data":2 },
{ "building" : "Building #6", "data":3 }
],
"floors" : [
{ "floor" : "Floor #4", "data":1 },
{ "floor" : "Floor #5", "data":2 },
{ "floor" : "Floor #6", "data":3 }
]
}
];
}]);
Accompanying fiddle
How do you go about changing the ng-options of other select dropdowns based off of the choice of another select?
All I did was add a "data" property to each object and update the ng-option.