javascript - How to remove selected dropdown values from other dropdown using lodash in angularJs -


i have 4 drop-downs:-

<div><label>priority:</label>     <label>first</label>         <select ng-model="a.priority[0]" ng-change="selectpriority(a.priority[0])" data-ng-options="x x in priorityarray">                 <option value="{{x}}"></option>           </select>          <label>second</label>           <select ng-model="a.priority[1]" ng-change="selectpriority(a.priority[1])" data-ng-options="x x in priorityarray" >                 <option value="{{x}}"></option>           </select>          <label>third</label>           <select ng-model="a.priority[2]" ng-change="selectpriority(a.priority[2])" data-ng-options="x x in priorityarray">                 <option value="{{x}}"></option>           </select>           <label>fourth</label>           <select ng-model="a.priority[3]" ng-change="selectpriority(a.priority[3])" data-ng-options="x x in priorityarray">                 <option value="{{x}}"></option>           </select>          </div> 

i want remove selected option 1 drop-down remove other drop-downs.

my directive code:-

(function () {     'use strict';     angular.module('myapp.components')         .directive('product', product);      product.$inject = ['$http', '$timeout'];      function product($http, $timeout) {         return {             restrict: 'ea',             scope: {},              link: function (scope, el, attrs) {                   scope.a = {};                 scope.priorityarray = ["one","two","three","four"];                  $('#product').on('hide.bs.modal', function () {                     scope.a = {};                 });                 $('#product').on('shown.bs.modal', function () {                  scope.selectpriority = function (priority) {                     scope.selectedpriority = [];                     scope.selectedpriority.push(priority);                     scope.priorityarray = _.difference(scope.priorityarray, scope.selectedpriority);                 }             },             templateurl: 'js/components/product.html'         };     }  })(); 

i using lodash filter getting filtered array in other drop-downs. using current solution, selected value filters original dropdown(from selected priority) too. want selected value remain in original dropdown. keeping different array each drop-down not efficient solution. can suggest me other solutions this?


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -