javascript - Sequenctial value in select dropdown -


i have 3 select dropdown , want scenarios below:

  1. if select 1 in dropdown1 other value 2 , 3.

dropdown1:1

dropdown2:2

dropdown3:3

enter image description here

  1. if select 1 in dropdown2 other like:

dropdown1:3

dropdown2:1

dropdown3:2

enter image description here

  1. will like:

dropdown1:2

dropdown2:3

dropdown3:1

enter image description here

codepen

<body ng-app="my-app" ng-controller="my-controller">   <select class="form-control" ng-options="obj obj.title obj in sequence" ng-model="selectedview1"></select>     <select class="form-control" ng-options=" obj.title obj in sequence" ng-model="selectedview2"></select>     <select class="form-control" ng-options=" obj.title obj in sequence" ng-model="selectedview3"></select> </body> 

please see codepen link.

i added logic of changing other select boxes in case of choosing 1 in first box.

please take here.

using watch function, can update other boxes when select changed.

$scope.$watch('selectedview1', function(newvalue) {     if (newvalue && newvalue.title === 1) {       $scope.selectedview2 = $scope.sequence[1];       $scope.selectedview3 = $scope.sequence[2];     } }); 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -