emberjs/ember.js — pull request #2464 by nerdyworm (2013-04-13 16:56:00+00:00)
Title: Making Router#url a property

The motivation behind this change was to enable an easy way observe url changes for analytics.

The current implementation triggers two change events when the application boots. This behavior seems incorrect. In addition the change events would notify the observers before the url was actually changed.

I modified the "navigating away triggers url property change" test to reflect the fact that handleURL should only trigger one change event. Also added test to ensure that the url property is set to the correct url provided by the location.

This pull request enables users to do simple things like this:
``` js
App.Router = Ember.Router.extend({
urlChanged: function() {
gaq.push(['_trackPageview', this.get('url')]);
}.observes('url');
});
```