mardi 9 juin 2015

If I use renderTemplate how to refresh route in ember?

My two routes have the same template and controller so my route want to use renderTemplate the same template and controller, like:

OrderRoute = Ember.Route.extend 
  model: (params)->  
    Product.findAll(params)

  setupController: (controller, model)->
    @controllerFor('products/index').set('model', model)

  renderTemplate: ->
    @render 'products/index',
      controller: 'products/index'

  actions:
    queryParamsDidChange: ->
      @refresh()

The controller:

ProductIndexController = Ember.Controller.extend
  queryParams: ['number']

  number: null

The code look like is no problem, but when I use I found the query params could not work.

I could not google anything about this question.
Maybe there is any better way to approach this problem?

Aucun commentaire:

Enregistrer un commentaire