user3847750 user3847750 - 3 months ago 8
AngularJS Question

How make text <option> bold on selection ? plz give me suggestion in HTML , CSS , ANGULAR JS

For example - Drop down is having some options like India , America , England , By default top most option is "Choose Your Country" . My doubt is , On selection
- if i choose India . Select should show "India" as bold , if i go back and select "choose Your Country" . Select should show "choose Your Country" as text ( not bold ) .please give me suggestion in html or angular . it would be helpful .

Answer

You can do this using ng-class.

<div ng-controller="MyCtrl">
 <select ng-model="selectedVal" ng-class="{'bold':selectedVal!='Choose'}">
    <option value="Choose">Choose</option> 
    <option value="Grandvalira">Grandvalira</option> 
    <option value="Vallnord">--Vallnord</option> 

 </select>
</div>

Working Demo