0

I need to bind by default the second value in my select drop down which I'm generating with a list of numbers from 0.01 to 10

                getComms();
                function getComms() {
                     $scope.numbersArray=[]
                    for (var j=1,i = 0.01; i <= 10; i += 0.01,j++) {

                        var newArray={
                            id:j,
                            value:i
                        }
                        $scope.numbersArray.push(newArray);

                    }
                }

Heres my select dropdown

  <select ng-model="test.info" class="form-control" ng-options="r.id as r.value for r  in numbersArray"  tabindex="1">
                    <option value="">--Select--</option>
                </select> 

1 Answer 1

1

In your controller, you will have to explicitly set your model equal to the second element in the array.

$scope.test.info = $scope.numbersArray[1];

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.