0

I have a select with options getting from server

<div class="form-group">
<label for="exampleInputEmail1">Terminal Type</label> 
<select ng-model="terminal.terminalType" id="terminaltype" class="form-control" ng-options="type.name for type in types">                                                                                       
</select>
</div>

but how can I set option in my controller. I used:

$("#terminaltype").val($scope.types[0]);

and

document.getElementById("terminaltype").options[i];

but it does not work. Please help me

1 Answer 1

1

Can't you set the value inside the model?

You have ng-model="terminal.terminalType"

Inside your controller, you just have to set a value to your item.

$scope.terminal.terminalType = "someValue";

Avoid mixing JQuery and Angular together.

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.