如何在切换下拉菜单中显示默认值?

问题描述 投票:0回答:1

我创建了下拉列表,它有2个值:1)Value1 2)Value2

我想选择Value1作为下拉列表中的默认值。我创建了以下内容,但它只是硬编码Value1而不是重定向到Value1

<div class="col-md-4" style="margin-right:10px;">
    <button class="btn btn-default dropdown-toggle" type="button"
            id="dropdownMenu1" data-toggle="dropdown"
            aria-haspopup="true" aria-expanded="true">
        Value1
        <span class="caret"> </span>
    </button>
    <ul class="dropdown-menu" aria-labelledby="dropdownMenu1" ng-model="auditToggle">
        <li><a ng-click="methodName('/method1')">Value1</a> </li>
        <li><a ng-click="methodName('/method2')">Value2</a> </li>
    </ul>
</div>
html angularjs html5 angularjs-directive
1个回答
0
投票

尝试

<li [value]="'Value1'"><a ng-click="methodName('/method1')">Value1</a> </li>
<li [value]="'Value2'"><a ng-click="methodName('/method2')">Value2</a> </li>
© www.soinside.com 2019 - 2024. All rights reserved.