My $http call in Angular is returning a deeply nested JSON object. To present this data in my template, I have to use multiple ng-repeats. However, I am struggling to bind the data using ng-model on a text input.
I came across this question which mentioned that the return object isn't automatically added to the $scope, and you need to loop through the data and set up the structure manually. I tried doing that but encountered the same issue.
// Code that may not be needed
angular.forEach(Object.keys($scope.sources), function(sourcename){
$scope.sourceData[sourcename] = {};
angular.forEach(Object.keys($scope.sources[sourcename]), function(key){
$scope.sourceData[sourcename][key] = $scope.sources[sourcename][key];
});
I have created a fiddle showcasing my attempts:
My goal is simple - I just want the values to populate in the fields and be bound to the model. Any advice would be greatly appreciated. Thank you.