I'm trying to resolve one attribute that I'm passing within transitionTo()
, but it always return as a string <(subclass of Ember.ArrayProxy)%3Aember334>
, so I cannot resolve this "ArrayProxy". If I print the attribute before the transitionTo() the value is there, but for some reason it converts to an "ArrayProxy" and not the value I'm setting before...
The way I'm doing now is setting an attribute in my model and getting it back which is FINE.
What I want is to return in the URL the projects and pages the user is filtering and get the parameters from there
Here is my action:
actions: {
changePage(route, queryParams, page) {
console.log(this.getQueryParams(queryParams, page));
this.get('router').transitionTo(route, { queryParams: this.getQueryParams(queryParams, page)});
// this.get('router').transitionTo(route, { queryParams: { page: 3, projects: ["162"]}});
// EVEN PLACING THE VALUE STATICALLY DOES NOT WORK
}
}
In my Route I have this:
export default Ember.Route.extend({
queryParams: {
page: {
refreshModel: true
},
projects: {
refreshModel: true
},
},
beforeModel: function(transition) {
// I THINK I NEED TO DO SOMETHING HERE
},
model(params) {
// params returns strings
// params.page returns the page correctly
// params.projects but it returns that "ArrayProxy"
// THIS IS HOW I'M DOING.
// I dont think this is the best way of doing and that's why I'm asking for help.
// I think there must be a way to change the URL and the get parameters there!
let query_params = this.get('modelQueryParams'); // modelQueryParams is setted in the filter action...
return Ember.RSVP.hash({
inventoryProject: this.get('store').findAll('inventoryProject'),
inventorySummary: this.get('store').query('inventorySummary', query_params),
});
This is the result of the URL:
http://localhost:4200/?page=3&projects=%3C(subclass%20of%20Ember.ArrayProxy)%3Aember334%3E
This is how it should be:
http://localhost:4200/?page=2&projects%5E%5D=162
Aucun commentaire:
Enregistrer un commentaire