I'm new to Ember, and have been impressed so far by how succinct everything is. Though querying data with EmberFire seems a little odd. For instance, in a component's js I can find a record with :
store.query('user', { orderBy: 'email', equalTo: email })
.then( (response) => {
// expect response to be an object, or an array of objects
// but its actually a class, and needs the following to return data
var user = response.get('content')[0]._data;
// now able to access properties as originally expected
console.log(user.email);
});
While the above works, it doesn't feel very elegant. Am I missing something? As far as I can see the documentation stops at explaining the query, so any help as to the proper way of accessing a model's properties would be much appreciated.
Thanks
Aucun commentaire:
Enregistrer un commentaire