Angular ngmodel ng隐藏不使用ng模型
我想从下拉列表中显示/隐藏特定选项选择上的div。 但是潜水艇一直隐藏着Angular ngmodel ng隐藏不使用ng模型,angular-ngmodel,ng-hide,Angular Ngmodel,Ng Hide,我想从下拉列表中显示/隐藏特定选项选择上的div。 但是潜水艇一直隐藏着 <select class="form-control" ng-model="Type"> <option>First</option> <option>Second</option> <option>Third</optio
<select class="form-control" ng-model="Type">
<option>First</option>
<option>Second</option>
<option>Third</option>
<option>Forth</option>
</select>
<div ng-hide="Type==='First'">
<label>Div Content</div>
</div>
为此,ng开关指令更适合。 请看 html:
我在ng switch中进行了多选项比较,当时,我认为不可能使用ng-switch。您好,您的问题是“想从下拉列表中显示/隐藏特定选项选择的div”,那么其他多选项是什么?看看这个也许会有帮助
<div ng-app="app">
<div ng-controller="Ctrl">
<select ng-model="selection" ng-options="item for item in items"></select>
<hr/>
<div class="animate-switch-container" ng-switch on="selection">
<div ng-switch-when="first">First option</div>
<div ng-switch-when="second">Second option</div>
<div ng-switch-when="third">Third option</div>
<div ng-switch-when="forth">Forth option</div>
<div ng-switch-default>default</div>
</div>
</div>
</div>
var app = angular.module('app', []);
app.controller('Ctrl', function ($scope) {
$scope.items = ['first', 'second', 'third', 'forth'];
});