Ember: Programmatically set queryParams in Mixin

I am trying to programmatically define queryParams in Ember.Mixin.

The mixin has a method that is called when the controller containing the mixin is initialized.

setupQueryParams: (params) ->
  params.forEach (param) =>
    @get('queryParams').push(param)

      

Later in the action defined for the mixin, I call @transitionToRoute({queryParams: {someParam: 'something'}})

nothing happens. However, when I explicitly define my queryParams it works.

+4


source to share


1 answer


queryParams

are eliminated from the proto class, not the instance, so any function init

will not be applied in time to eliminate ember.



This means late binding is queryParams

not possible the way you want it to.

+1


source







All Articles