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

python - Strange behavior using PyQt4's 'pyqtSlot' decorator before another decorator -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

c# - Process.Kill() returns access denied -