Listening for events and knowing which parameters are passed


I was hoping to use some events… particularly $ionicView.enter

I was looking at the documentation here

And I don’t see any reference to what parameters can be passed to the function but I see people using it like so

$scope.$on( “$ionicView.enter”, function( scopes, states ) {
if( states.fromCache && states.stateName == “your view” ) {
// do whatever

So in the above example they are using scopes and states…which of course is being passed, Is this documented anywhere ?

I am sure I have overlooked something.

Thanks in advance.

Anybody able to comment on this ?

Just really looking for pointers to documentation which I can’t seem to find.

Thanks again


I thing you point is not the $ionicView.enter event but AngularJS $scope APIs, so you’d better read the doc from AngularJS first.

When you emit an event with $scope.$emit(name, args) or $scope.$broadcast(name, args), it pass the args(custom arguments, single or multiple) to the listener(i.e. the 2nd argument of $scope.$on(name, listener)). The arguments you can pass will be flexible, and you can define an specification(e.g. what arguments will be pass into an event) which you need to do.

Hope this can help you :smile:

Ah Ok, thanks santinowu. Yes I was aware of this, so the example I saw they must have been doing there own $emit / $broadcast.

I now see that most of the examples are like this

$scope.$on(’$ionicView.enter’, function () {


So the system doesn’t send any parameters in.

Thanks for the confirmaton here, I now I have it clear.