Angular JS - Update input options with other input options
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<div ng-controller="myCtrl" ng-app="myApp">
<div>
<select ng-model="selectedCountry" ng-options="country.name for country in countries" ng-change="changeChipping()">
</select>
</div>
<div>
<select ng-model="selectedCountry" ng-options="country.name for country in countries" ng-change="changeChipping()">
</select>
</div>
Shipping costs: {{selectedCountry.shipping}}
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.countries = [{
"name": "Freedonia",
"shipping" : "30"
},{
"name": "Mordor",
"shipping": "70"
},{
"name": "Oz",
"shipping": "100"
}];
$scope.selectedCountry = $scope.countries[0];
//Bit required for ng-Cart directive
$scope.changeShipping = function() {
ngCart.setShipping ($scope.selectedCountry.shipping);
};
});