it's my first time here on stack and I hope someone can help me because I'm stuck!
I have a script made in AngularJS that creates multiples icons extracting the data from a simple array. Every icon is associated to a youtube video.
The array and the function is simple:
app.controller('videolist', function ($scope, $http) {
$scope.videos = ['q_664lrmyGE','q_664lrmyGE','dWuEVSCw8B8','3Wm3G8s8bxk','_ppuCZR8Mkw','9gN_cmK9TUc','s7lVGhTPQAY','_rNmmHXEdTc','blr-qDffIq0','_70M4lkLKPk','wjB9JtTU7SU','BGh1xc-O0WA','uxEBK9q686c','ToO-tS-X2U4','AKrmrbCTNxc'];
$scope.icon = [];
// add youtube videos
for (i=0; i<$scope.videos.length; i++) {
$scope.icon.push({id: $scope.videos[i], thumb: 'mqdefault'});
}
});
Now I would like to load the array from an external JSON file.
I've tried in any way possible, but didn't work. How I can do it? And how should the JSON file be composed? In every example I've see there are at least two or three values that makes one record, or a pair made with "label":"value".
Thank you so much!!