Answer the question
In order to leave comments, you need to log in
Why does it duplicate events on state.reload?
export class AppController {
constructor(Guard, $state, $rootScope, $injector) {
'ngInject';
this.guard = Guard;
this.state = $state;
this.rootScope = $rootScope;
this.init();
}
init() {
this.pageTitle = this.state.current.ncyBreadcrumb.label;
this.help(this.state.current.url);
this.rootScope.$on('$locationChangeStart', (event, toState, toParams, fromState, fromParams) => {
this.guard.loadUser();
});
this.rootScope.$on('$stateChangeSuccess', (event, toState, toParams, fromState, fromParams) => {
console.log(1);
});
}
}
Answer the question
In order to leave comments, you need to log in
I suspect that with each initialization, a new handler is hung up, and the old one is not deleted. Events need to be monitored. Why is this in the controller at all?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question