简体   繁体   中英

Is there a way to listen to angular events like routechangestart from outside, like from browser console or an add on?

I want to listen to routechangestart event of my application from browser console or inside a browser extension. Is there a way to do this? I haven't tried anything yet because I have little knowledge about how Angular works. I want this to notify the user whenever a view is changed.

Any help is appreciated.

Well you want some code to be executed from console at state change events, you could use something like:

angular.element(document).scope().   $on("$stateChangeStart",function(){//your code here
}

Just change the event name from $stateChangeStart to whatever event you want to listen to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM