I need to make a selection of a select with a div
when selecting the option.
I'm using angular, how can I do this?
I need to make a selection of a select with a div
when selecting the option.
I'm using angular, how can I do this?
Only use the ng-show
directive.
angular.module('app', []).controller('mainController', function($scope){
$scope.mostrarDiv = false;
$scope.opcoes = [
{ descr: "Mostrar", valor: true },
{ descr: "Não mostrar", valor: false }
];
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script><divng-app="app" ng-controller="mainController">
<select ng-options="opcao.valor as opcao.descr for opcao in opcoes" ng-model="mostrarDiv"></select>
<div ng-show="mostrarDiv">
Alguma coisa
</div>
</div>