Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Ember query result undefined

$
0
0

@FlorianKrippner wrote:

Hej, i have the following problem:

i wanted to transform this WORKING code:

  myStore.query('test', {}).then(backendData => {

        backendData.forEach(element => {
          var example = element.get('example');
          console.log(example);                  //works. i get a output
          }
        });

into a code without .then and without .foreach, because i want to use yield inside the foreach and i cant because the scope.

so i did this now:

var result = yield myStore.query('test', {});

for(var i = 0; i < result.length; i++)
{
        console.log(result.length);        //length 1
        console.log(result[i]);            //result[i] undefined result isnt null
}

the log says now, that the length of result is 1, but result[i] is undefined. whats the problem? I thought i can access that DS.PromiseArray that i am getting from query via []. or how does it work ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles