Created
July 11, 2014 07:42
-
-
Save ekancepts/a6b5f7fd681a90de9b9b to your computer and use it in GitHub Desktop.
drodown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* js controller */ | |
$scope.selms = {}; | |
$scope.selbs = {}; | |
$scope.selmos = {}; | |
$http.get( | |
'vehicle-manufacturers' | |
).success(function(data){ | |
console.log(data); | |
$scope.selms = data; | |
}) | |
$scope.selBrand = function(select_id) { | |
$http.get( | |
'vehicle-brands?vehicleManufacturer_id='+select_id | |
).success(function(data){ | |
console.log(data); | |
$scope.selbs = data; | |
}) | |
}; | |
$scope.selModel = function(select_id) { | |
$http.get( | |
'vehicle-models?vehicleBrand_id='+select_id | |
).success(function(data){ | |
console.log(data); | |
$scope.selmos = data; | |
}) | |
}; | |
/* view */ | |
<div class="uk-form-row"> | |
<label for="manufacturer" class="uk-form-label">Manufacturer</label> | |
<div class="uk-form-controls"> | |
<select ng-model="aset.vehicle_manufacturer_id" ng-change="selBrand(aset.vehicle_manufacturer_id)"> | |
<option value="">-- choose Manufacturer --</option> | |
<option class="uk-form-width-medium" ng-repeat="selm in selms" value="{{selm.id}}">{{selm.caption}}</option> | |
</select> | |
</div> | |
</div> | |
<div class="uk-form-row"> | |
<label for="brand" class="uk-form-label" >Brand</label> | |
<div class="uk-form-controls"> | |
<select ng-model="aset.vehicle_brand_id" ng-change="selModel(aset.vehicle_brand_id)"> | |
<option value="">-- choose Brand --</option> | |
<option class="uk-form-width-medium" ng-repeat="selb in selbs" value="{{selb.id}}">{{selb.caption}}</option> | |
</select> | |
</div> | |
</div> | |
<div class="uk-form-row"> | |
<label for="model" class="uk-form-label">Model</label> | |
<div class="uk-form-controls"> | |
<select ng-model="aset.vehicle_model_id"> | |
<option value="">-- choose Model --</option> | |
<option class="uk-form-width-medium" ng-repeat="selmo in selmos" value="{{selmo.id}}">{{selmo.caption}}</option> | |
</select> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment