I need to access and manage options
in select
element by AngularJS. I am passing it to JSP using model.addAttribute("environmentsMap", getEnvironments());
. For some reason one of options ends up as
<option value="? undefined:undefined ?"></option>
although on server side there are no empty or null elements. How to fix it?
<ng-form id="form" name="form" ng-class="{'has-error': test.$invalid}" class="form-group">
<select name="environment" id="environment" name="environment_name" class="form-control" ng-model="environment" required>
<c:forEach var="environment" items="${environmentsMap}">
<option value="${environment.key}"
${environment.key && environment.key == "TEST" ? 'selected' : ''}>${environment.key}</option>
</c:forEach>
</select>
</ng-form>
Is there a better way to do it?