Best practise for fetching data in a controller


#1

hi!

I have an ember app which I want to extend with a dashboard graph. The graph has some interactive features like showing/hiding different graphs or setting the time range. I already implemented the interface and properties of the controller get updatet but I want to have an computed property in the controller which triggers a api endpoint with these properties to fetch the right data. The problem right now is, that my promise is not resolved when I try to use the computed property in my template. If I try to fetch a record from the store, it works but I dont have a model for this. Is it possible to fetch data from the controller without a model? Or am I already on the wrong way? How would you implement this? Is there any best practise for fetching simple stuff without a model in ember?

thanks for your help.

b


#2

If I’m understanding right, you essentially want to use properties of fetched data in your template. Look into promise proxies. http://emberjs.com/api/data/classes/DS.PromiseObject.html