0

this is how i am trying to access the select dropdown and now i want to select the option of which i have a value :

var A    
A= document.getElementById("aID");

this is the value i am getting while editing a row record using angular JS :

$scope.Act[index].ATextValue;

and i am trying to get which is wrong but i want the correct solution or way to do this :

 document.getElementById("aID").selectedValue=$scope.Act[index].ATextValue;
1

2 Answers 2

1

Try Using this code

<select ng-model="selectedName" >
   <option ng-repeat="x in names" ng-value="x">{{x}}</option>
</select>
Sign up to request clarification or add additional context in comments.

Comments

1

I'm not sure what you are trying to achieve but here is a sample snippet on implementing a simple dropdown select.

HTML for Dropdown:

<select ng-model="selectedName" ng-change="ShowSelectedValue()"
        ng-options="x for x in names">

Angularjs:

// Dropdown Items
$scope.names = ["a", "b", "c"];

// When an item is selected, an alert is displayed
// $scope.selectedName will be the container of the selected value
$scope.ShowSelectedValue = function (){
  alert($scope.selectedName);
}

I hope this helps!

3 Comments

i have to edit one row data and on clicking the row button i am trying to get the data into the form which has select and i dont know how to select the value according to the data in the row
@BKM show your code for me to fully understand your problem. Thank you
i just want to select the option which has the value i got from clicking on get details of a record so for example i got a dropdown of fruits and the record has apple then apple should be selected or if i have the value orange then option orange should be selected

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.