vendredi 31 juillet 2015

Ember change view on controller's action

I want to change my view on click, click would trigger the action in controller and there I want to change the view.

The other work around I was trying is to set a value of variable as True at route level like this,

  setupController: (controller, model) ->
    controller.set('model', model)
    controller.set('dashboardView', true)

and then using this dashboardView on template show the Dashboard, otherwise show Google Map.

Emblem template

if dashboardView
  render 'dashboard' dashboardData
else
  render 'map' MapData

The action that triggers on click sets the 'dashboardView' to false but does not change the view.

Please let me know which way is the better one, or if there is another right way to do this.




Aucun commentaire:

Enregistrer un commentaire