ember.js - Callback for change in URL in Ember v1.0.pre -
i want call function when change in url. in newer versions of ember, can observing currentpath. in version, tried this:
ember.route.reopen({ enter: function(router) { console.log('change in url , need called once per change in url'); } }); since there nested routes, method called mutiple times.
if using ember.hashlocation can this, observing lastseturl property:
window.app = ember.application.create({ ... urlchanged: function(a,b,c,d) { var url = this.get('router.location.lastseturl'); if (!ember.none(url)) { alert(url); } }.observes('router.location.lastseturl'), ... }); here example of working http://jsfiddle.net/marciojunior/ba4hj/
Comments
Post a Comment