Hey there,
I'm trying to make sure that only the option corresponding to the code used by the client to log in is displayed.
The HTML should show the option that matches the client's login code.
View:
<div class="">
<select id="customer-dd" ng-model="selectedCustomer" ng-repeat="(group, msg) in codes">
<option value="">select...</option>
<div ng-if=" 'group' == 'code' ">
<option value="{{ group }} ">{{ msg }}</option>
</div>
</select>
</div>
Controller:
$scope.code = dataFactory.getCode();
$scope.codes = {
'ABC': 'First option',
'DEF': 'Second option'
}
Only one option should be visible since a client can't log in with more than one code at once.
However, I am getting two input boxes instead of just one that matches the code. Am I missing something?
* UPDATE *
I have made some changes to the code as follows and still seeing multiple options being printed:
<div class="">
<select id="customer-dd" ng-model="selectedCustomer" ng-repeat="(group, msg) in codes">
<option value="">select...</option>
<div ng-if=" group == code ">
<option value="{{ group }} ">{{ msg }}</option>
</div>
</select>
</div>
* UPDATE * @ieaglle Removing the div allowed the if statement to execute properly. The updated HTML now looks like this:
<div class="">
<select id="customer-dd" ng-model="selectedCustomer" ng-repeat="(group, msg) in codes">
<option value="">select...</option>
<option ng-if=" group == code " value="{{ group }} ">{{ msg }}</option>
</select>
</div>
THANK YOU SO MUCH!!!