Thank you Kamal.
In fact, I want to listen to $routeChangeStart event, I found an example
here<http://stackoverflow.com/questions/11541695/angular-js-redirecting-to-a-certain-route-based-on-condition?rq=1>.
What I confused is how to know the callback receives "next", "current" as
arguments. The api doc of module
ngRoute<http://code.angularjs.org/1.2.14/docs/api/ngRoute/service/$route>
doesn't
reveal anything.


2014-03-12 1:11 GMT+08:00 Kamal <[email protected]>:

> Siyuan,
>
> "args" are the arguments which are passed to the $emit/$broadcast methods
> which invoke the methods registered using the $on. Let's see an example
>
> $scope.$emit('myevent', "First Name", "Last Name", 3, "Test"); -> To Emit
>
> $scope.$on('myevent', function(event, fname, lname, role, extra) {
>   // fname -> "First Name"
>   // lname -> "Last Name"
>   // role -> 3
>   // extra -> "Test"
> });
>
> this can be either $rootScope or any scope.
>
>
>
> On Tuesday, 11 March 2014 22:10:43 UTC+5:30, Siyuan Wang wrote:
>>
>> I have looked through the api doc from Dash of my mac, the doc only shows
>> that
>>>
>>> The event listener function format is: function(event, args...)
>>
>> which doesn't explain what the "args" is!  That means *nothing* for me.
>> Where can I find the *exact format *of the listener function?
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/hfkrsHdLuCE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
王思源
------------------------
中山大学  软件学院
电话:15902025247
Email:[email protected]
QQ:290744394

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to