Looking for a way to execute code whenever the active state changes? I keep track of the value like this:
export class AdminLayoutComponent implements OnInit, AfterViewInit {
activeState: string;
constructor(private router: UIRouter) {
this.activeState = this.router.stateService.$current.name;
}
}
Is there a method to run a code snippet (which assigns a class in the navigation menu for the active state) each time the current state is updated?