Answer the question
In order to leave comments, you need to log in
How to set select values on load in angularjs array?
Good day, dear developers! Yes, judging by the title, not everything is clear, I don’t know how to formulate the question correctly, I made an example on jsfiddle . In the example, {{options}} contains the GROUP_DEFAULT_TASK value, and that's only because it's explicitly set in the script:
var defaultIndex = 0;
$scope.rightsData.tasks.forEach(function(task, i) {
if(task.id == $scope.rightsData.default)
defaultIndex = i;
});
$scope.options = {};
$scope.options.GROUP_DEFAULT_TASK = $scope.rightsData.tasks[defaultIndex].id;
{"GROUP_DEFAULT_TASK":"132","TASKS_3":"133","TASKS_7":"134"}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question