i filled my dropdownlist by angular js from json. But selection is not working. How can i select dropdownlist item?
TaskTypeDefinitionController.js:
var roleList = [{"id" :1, "value" :"test" },{"id" : 2, "value" : "test2"}];
roleList.then(function (data) {
$scope.roleList = data;
var jsonArr = [];
for (var i = 0; i < data.length; i++) {
jsonArr.push({
id: data[i].roleName.serno,
value: data[i].roleName.value
});
}
$scope.Names = jsonArr;
console.log(jsonArr);
});
html(View) :
<select class="form-control" placeholder="Görev Tipi Adı" ng-
options="field.id as field.value for field in Names" ng-model="Name"
required></select>
ng-modeladdedconsole.log($scope.Name);and check in browser's console.