I have this code
<select ng-model='item.data.choice' >
<option ng-if='item.data.simple_allow_blank == false' ng-show='choice.name' ng-repeat='choice in item.data.simple_choices' value="{{choice.name}}" ng-disabled="$parent.controllerAction == 'show'">{{choice.name}}</option>
</select>
It shows the 3 choices entered by the Admin of the system in a dropdown box. It shows it without the blank choice.
The problem is if I want to put a default value (for example, choice[0]
), it adds a blank value.
Also when converting from ng-repeat
to ng-options
from this question.
I have 4 choices 1,2,3 and blank i wanted to remove the blank i followed the guide/answers found on the link i have posted with my question, the difference in my part is that i have a dynamic list and when the list is newly created. it never fails to include the blank when using ng-option but it solves my problem to have an initial default value from the dynamic list, if i use ng-repeat i dont have the initial value but the blank from the choices where remove. i wanted to have the blank choice remove and the same time to have an initial value from the dynamic list.
I can set the default value but it cannot remove the blank option.
Can anyone help? Thanks.