ember.js - Ember Iterating through a promise/ store.findAll return value -


in router have code let users= this.store.findall('user')

and model user.js name: ds.attr('string'), username: ds.attr('string'), company: ds.attr('string')

in mirage fixture have user object defined [{'name':'smith','username':'smith123'},{'name':'james','username':'james222'}

and in router when let users= this.store.findall('user') want iterate through users , add company manually each user. unable find way access user objects in router js file.

and same object can iterate in .hbs file. unable find way iterate in router js file. can please let me know way this.

findall method (and findrecord too) returns promise, not iterable object. can iterate through users after promise resolved. this, should use then method:

this.store.findall('user')   .then(users => {     /*iterate here*/   })   .catch(error => {     /*do inform user network/server/request error here*/   }); 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -