javascript - Ember.js: Howto create routes that only execute code -


my app has main view hidden elements can activated user. typical sidebar on mobiles slides in left. or cart reveals details when tap on it.

the information in hidden elements date since content mapped in main app template. routes not need render dom.

the transitions js based. want states reflected in url, in order consistent button behavior.

how can achieve using ember framework?

update make more clear, talking about:

to understanding triggering routes in ember has 2 side-effects:

  1. represent new state in url, enabling consistent browser history support.
  2. render templates manipulate dom based on data

in case, when instance user taps on minimized cart need:

  1. represent new state in url, enabling consistent browser history support.
  2. execute showcart() js function (no dom changes, no template rendering)

when user taps on browser button, closecart() should executed (based on fact state in url carries information cart open).

you can use activate , deactivate methods show route, know when entered or exited route:

app.showroute = ember.route.extend({     activate: function() {         alert('entering in show');         // here showcart     },     deactivate: function() {         alert('exiting show');         // , here closecart     } }); 

i created live demo here, see working.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -