I want to display the country in response from dropdown. I tried a lot and I could not find any solution.
I am using a JavaScript link " http://iamrohit.in/lab/js/location.js ".
I am getting the selected country name from JSON response but can't compare it with the dropdown list and display the response value.
My HTML :
<select name="country" class="form-control1 drop countries" required ng-model="model.country" placeholder="select" id="countryId sel1"><option value="" disabled selected>Select</option>
My controller :
$scope.model.country = "India"; //from json response
I saw this " <option value="? string:India ?"></option>
<option value="? string:India ?"></option>
" when I inspect the country field in the profile page.
If you want to view what option is selected, the you will indeed put your ng-model in your tag. But if I understand correctly, you want to create different options according to your JSON data. I suggest using:
<select>
<div ng-repeat= "x in model.country">
<option> {{x.Name}} </option> //I suggest dividing your JSON information
</div>
</select>
I hope this answers your questions. Let me know if you need more precise information!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.