I try to define a dynamic variable name in a angularjs foreach, like this :
angular.forEach($scope.posts, function (item) {
// counter increment
counter++;
var idPage = 'feed' + counter;
FeedService.parseFeed(url).then(function(res) {
$scope.window[idPage] = res.data.responseData.feed.entries;
});
});
so, it's doesn't work and i have this error : Cannot set property 'feed1' of undefined
what's the correct syntax ?