.controller('Ctrl', function ($scope) {
$scope.$on('$ionicView.loaded', function () {
//do something
}
}
.controller('Ctrl', function ($scope) {
//do something
}
i know that the //do something will run after $ionicView is loaded
from what i test from the above two snippet, the //do something code run immediately when i click a link
is there any special use case that I can use $ionicView.loaded or
is there any performance advantage?
I use $ionicView.loaded for analytics (“page views”) or tracking other events, it’s best to not think of it as a Controller init VS event and more of a way to add code execution after that event is fired as it will be called no matter what view is loaded where as your controller is loaded for a specific state.