0

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;
1
  • Could you elaborate a bit on what is the expected result and what is not working? Commented Feb 27, 2019 at 13:05

1 Answer 1

1

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/
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.