I am new AngularJS framework. I have few questions related to use of <select>
tag in angularjs.
Firstly, whenever I am putting the first value of the option in the <select>
tag, it shows an extra blank option in the drop down. Then, when I select any of the options in the dropdown, it disappears.
Secondly, whenever I am keeping any of the options blank, then it behaves normally.
Why is it happening.?
Here's the code:
<html>
<head>
<title>AngularJS Binding</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.js"></script>
</head>
<body ng-app="app">
<div>
Search 1: <select ng-model="optval1" >
<option value="any">Any</option>
<option value="name">Name</option>
<option value="city" selected>City</option>
</select>
<br>
Selected Value={{optval1}}<br><br>
Search 2: <select ng-model="optval2" >
<option value="">Any</option>
<option value="Name">Name</option>
<option value="City">City</option>
> </select>
<br>
Selected Value={{optval2}}
</div>
</body>
</html>