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

Merge multiple record partial data into unique model

$
0
0

Hi, I’m querying multiple endpoints which each are returning part of a model.'s data :

model: function() {
		const id = this.paramsFor('users.user').id;
		const promises = {
			a: this.get('store').queryRecord('mymodel', {
				id: id,
				endpoint: 'a'
			}),
			b: this.get('store').queryRecord('mymodel', {
				id: id,
				endpoint: 'b'
			})
		};

		return hash(promises);
	},

Is there a way of getting a model which concats the data of all the endpoints instead of having to deal the “alias” of each query like : this.model.a.xxxx

Note : I’m using ember 3.14 Note 2 : I’m quite new to the ember world , so maybe i asking something that shouldn’t be done

Thanks :slight_smile:

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 4870

Trending Articles