Router#didTransition()

didTransitionpublic

Defined in packages/ember-routing/lib/system/router.js:227
Available since 1.2.0

Handles updating the paths and notifying any listeners of the URL change.

Triggers the router level didTransition hook.

For example, to notify google analytics when the route changes, you could use this hook. (Note: requires also including GA scripts, etc.)

let Router = Ember.Router.extend({
  location: config.locationType,

  didTransition: function() {
    this._super(...arguments);

    return ga('send', 'pageview', {
      'page': this.get('url'),
      'title': this.get('url')
    });
  }
});
doc_EmberJs
2016-11-30 16:53:17
Comments
Leave a Comment

Please login to continue.