javascript - angularJS - add a Static option with ng-options -
i using ng-options print options form in angular app. value directly database gives me list of countries:
<select ng-options="country.country country in countries" ng-model="selectedcountry" ng-change="updateselectedcountry(selectedcountry)" class="form-control"> here when page loaded, select doesnt show anything, i.e. there no placeholder whereas i'd print static value "anywhere" without having add in "countries" list.
i have tried this:
<select ng-options="country.country country in countries" ng-model="selectedcountry" ng-change="updateselectedcountry(selectedcountry)" class="form-control"> <option>anywhere</option> </select> but it's not working
does have idea how solve this?
thanks
you this:
<select ng-model="selectedcountry" ng-change="updateselectedcountry(selectedcountry)" class="form-control"> <option>anywhere</option> <option ng-repeat="country.country country in countries">{{country.country}} </option> </select> here fiddle example
hope helps!
Comments
Post a Comment