javascript - Dynamic variable name of scope -
I tried to define foreach Koniyriyj a dynamic variable names do, such as:
< code> Angular.for each ($ scope.posts, function (item) {// counter increment counter ++; var idPage = 'feed' + counter; Feedsewa. Piarafaf (URL). then (function (res) {$ Scope.window [idPage] = Res.data.responseData.feed.entries;});});
So, it does not work and I have this error: can not set property is undefined to feed 1 '
What is the window
property in your $ Scope object? If so, go with Maxim's answer. If not, try:
Angular. ForEach ($ scope.posts, function (item) {// counter increment counter ++; var idPage = 'feed' + counter; FeedService.parseFeed (url). Then (function (res) {$ scope [Aideepej] = Res.data.responseData.feed.entries;});});
Editing:
Performance:
Comments
Post a Comment