Angular:无法在级联下拉列表中选择默认选项

时间:2015-02-12 11:16:28

标签: javascript angularjs drop-down-menu

<select class="form-control" ng-model="defaultFirstMenu" ng-options="item as item.menuName for item in firstLevelList"></select>


<select class="form-control" ng-model="defaultSecondMenu" ng-options="item as item.menuName for item in (filteredSecondLevelList = (secondLevelList | filter:{parent: defaultFirstMenu.menuName}))" ng-init="defaultSecondMenu = filteredSecondLevelList[0]"></select>

选项将在第二个下拉列表中填充,但ng-init无法设置默认选项。 之前未声明 defaultFirstMenu 。请帮忙。

0 个答案:

没有答案