lundi 27 avril 2015

How to do a random number or timestamp using link-to and query-params?

I've got a simple route that should refresh when a query-param is updated

export default Ember.Route.extend({
    queryParams: {
        refresh: {
            refreshModel: true
        }
    }
});

Because this value needs to change for the refresh to work (in the above route) I need the value in my template to be random/new each time the page is rendered. Currently I'm trying to pass the link-to a random date value like so

{{#link-to "foo" (query-params refresh=new Date().toISOString())}}home{{/link-to}}

I've even tried creating a hbs helper that will return something template friendly but I can't seem to use that in the query-params link-to placeholder.

Anyone know a way to be pure template driven and add a random number or date value for the query-param? Or even better :) I'd just like to refresh regardless of the value being updated




Aucun commentaire:

Enregistrer un commentaire