I have a REST API that allows me to filter entities. I want to provide a quick access to those filtered entities from within my ember.js application. For example, routes /entities/my and /entities/group.
The question is how to access these “my” and “group” from within my model?
Should I use transition parameter or is there a more elegant way?
I also need to access the ApplicationController from within my model.
App.Router.map(function () {
this.resource("application");
this.resource("entities", { path: "/entities" }, function(){
this.route("my");
this.route("group");
});
});
App.EntitiesRoute = Em.Route.extend({
model: function (params, transition) {
console.log(transition.targetName);
// I also need to access the ApplicationController
// from within my model
}
});
Another related question is where should I define those AJAX requests? Should they go to the model or to the controller?
Is there an example on how do I fill in model from within my controller?