2016-08-11 41 views

回答

0

我想VM2添加到其他數據內容,但總是相同的值增加了兩個duallist

hmtl code

directives code

var existingEntries = []; 
    var vm = this; 
    vm.property = 'controller'; 

activate(); 

function activate() { 
    vm.leftValue = []; 
    vm.rightValue = []; 
    vm.addValue = []; 
    vm.removeValue = []; 

    function loadMoreLeft() { 
     for (var i = 0; i < $scope.reasonOfLack.length; i++) { 
      vm.leftValue.push({ 
       'name': $scope.reasonOfLack[i] 
      }); 

     } 
    }; 

    function loadMoreRight() { 
    } 


    vm.options = { 
     leftContainerScrollEnd: function() { 
     }, 
     rightContainerScrollEnd: function() { 
     }, 
     leftContainerSearch: function (text) { 
      console.log(text) 
      vm.leftValue = $filter('filter')(leftValue, { 
       'name': text 
      }) 

     }, 
     rightContainerSearch: function (text) { 

      vm.rightValue = $filter('filter')(rightValue, { 
       'name': text 
      }) 
     }, 
     leftContainerLabel: 'Uygunsuzluk Sebepleri', 
     rightContainerLabel: 'Seçilen Uyunsuzluk Sebepleri', 
     onMoveRight: function() { 
      console.log('right'); 
      console.log(vm.addValue); 

     }, 
     onMoveLeft: function() { 
      console.log('left'); 
      console.log(vm.removeValue); 
     } 

    }; 
    loadMoreLeft(); 


    var leftValue = angular.copy(vm.leftValue) 

    var rightValue = angular.copy(vm.rightValue) 

}