Muhammad Rashid
Muhammad Rashid

Reputation: 219

Angular js drop down selected is not working with asp.net mvc

Hi I am new in angularjs with asp.net mvc,i am facing drop down selection,when i try to selected the drop down its not working.

Html

 <select class="form-control" required="" name="ProfileID" ng-model="ProfileID">
                                                                    <option value="">--- Select an option ---</option>

                                                                    <option ng-selected= "{{st.ProfileID == ProfileID}}" ng-repeat="st in Profilelist" value="{{st.ProfileID}}">
                                                                        {{st.ProfileName}}
                                                                    </option>>
</select>

Controller

$scope.ProfileID = responce.data.data[0].ProfileID;//drop down selection

Drop down population

$scope.Profilelist = responce.data.data;

Upvotes: 0

Views: 52

Answers (1)

AhmAD
AhmAD

Reputation: 126

just remove the curly brackets fro the ng-selected so from
ng-selected= "{{st.ProfileID == ProfileID}}"
to be
ng-selected= "st.ProfileID == ProfileID"

will work on this link http://jsfiddle.net/kn7uzrva/

Upvotes: 1

Related Questions