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

sql - Find last match with latest inserted name in table -

c# - XML serialize base class without knowing derived class -

ios - Invalid IPA: missing embedded provisioning profile. Are you sure this is an ad hoc? -