Skip to main content
1 de 6
novic
  • 36,7mil
  • 4
  • 32
  • 70

var app = angular.module("app", []);
app.controller("ctrl", function($scope) {
  $scope.dropSelected1 = {
      'value': 1,
      'text': 'Tenis'
  };  
  $scope.dropItens1 = [{
      'value': 1,
      'text': 'Tenis'
    },
    {
      'value': 2,
      'text': 'Roupa'
    }
  ];
  
  
  $scope.dropSelected2 = {'value': 1, 'text': 'Adidas'}
  $scope.dropItens2 = [{
      'value': 1,
      'text': 'Adidas'
    },
    {
      'value': 1,
      'text': 'Olimpikus'
    },
    {
      'value': 2,
      'text': 'Camiseta'
    },
    {
      'value': 2,
      'text': 'Calça'
    }
  ];
  
  
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<div ng-app="app" ng-controller="ctrl">
  <select ng-options="option.text for option in dropItens1 track by option.value" ng-model="dropSelected1">  
  </select>  
  
  <select ng-options="item.value as item.text for item in dropItens2 | filter:{ value : dropSelected1.value }" ng-model="dropSelected2">  
  </select>
  
</div>

novic
  • 36,7mil
  • 4
  • 32
  • 70