Eric B. Eric B. -5 years ago 332
AngularJS Question

AngularJS $routeChangeSuccess callback arguments

I'm new to AngularJS and am confused by the documentation regarding event listeners.

The documentation lists the following for the


$routeChangeSuccess Broadcasted after a route dependencies are
resolved. ngView listens for the directive to instantiate the
controller and render the view.


broadcast Target:

root scope

However, no where does it reference any arguments that are passed to the callback function. And yet, most of the examples I've seen here on SO all have a similar callback function listing:

$rootScope.$on("$routeChangeSuccess", function(event, next, current) {

According to the AngularJS docs, all callbacks have the first argument as the
. I get that. But where are
coming from? Where is that listed in any of the documentation?

Answer Source

It was documented in version less than 1.2 see this old documentation. But it seems they haven't noticed that the callback signatures for their broadcast events are missing. On the other hand, if you don't mind reading from their github repository you can check this line here for the $routeChangeSuccess callback parameters.

Update: For the Route object you can actually refer to the $route properties documented here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download