Issue
I have a select html like this:
<select ng-model='nrSelect' class='form-control'>
<option value='47'>47</option>
<option value='46'>46</option>
<option value='45'>45</option>
</select>
How can I select the default value from typescript for example 47 ?
Solution
You can do this:
<select class='form-control'
(change)="ChangingValue($event)" [value]='46'>
<option value='47'>47</option>
<option value='46'>46</option>
<option value='45'>45</option>
</select>
// Note: You can set the value of select only from options tag. In the above example, you cannot set the value of select to anything other than 45, 46, 47.
Answered By - Shadab Faiz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.