Angularjs新手。我有一个控制器。
<div ng-controller='ConfigurableInputController as configurableInput'>
以上控制器声明中的几个ng-options:
<select class="dropdown-1"
ng-show="configurableInput.selectedCriteria === 'Channel'"
ng-model="configurableInput.selectedChannel1"
ng-options="channel for channel in configurableInput.channelList">
<option value="">--Please select the channel--</option>
</select>
<select class="dropdown-2"
ng-show="configurableInput.selectedCriteria === 'Channel'"
ng-model="configurableInput.selectedChannel2"
ng-options="channel for channel in configurableInput.channelList">
<option value="">--Please select the channel--</option>
</select>
<select
class="dropdown-1"
ng-show="configurableInput.retailArray.length > 0"
ng-model="configurableInput.selectedRetailLocation1"
ng-options="item1.retailLocation1 as item1.retailLocation1 for item1 in configurableInput.retailLocArray | filter : { retailLocation1 : '!!' }">
<option value="">--Please select Store Id--</option>
</select>
<select
class="dropdown-2"
ng-show="configurableInput.retailArray.length > 0"
ng-model="configurableInput.selectedRetailLocation2"
ng-options="item2.retailLocation2 as item2.retailLocation2 for item2 in configurableInput.retailLocArray | filter : { retailLocation2 : '!!' }">
<option value="">--Please select Store Id--</option>
</select>
我如何拥有一个可以重复用于所有上述4 ng选项的指令?