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 '

< P> What is the correct syntax?

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

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -