I'm trying to populate the form with Data that are coming from Database/JSON.
I can populate the text field but for some reason the select drop down and the checkbox are not being populated with data. The select should have "male" and the checkbox should be ticked because it's set true.
code:
<form>
<label>Gender:</label>
<select id="s1" ng-model="myData.gender"></select>
<br>
<label>Name:</label>
<input type="text" ng-model="myData.name">
<br>
<label>Active:</label>
<input type="checkbox" ng-model="myData.active" value="" id="checkbox" name="check" ng-init="myData.active=myData.active"><br>
<input type="button" value="Save" ng-click="Update">
</form>
//assume these data coming from database
$scope.myData = {
"name" : "John",
"active" : "true",
"gender" : "male"
};
So basically the whole idea is that, when the fields are populated, the user can change the values and then hit the Save button which will update the database with new data.
Can anyone help?