I wanted to find out the difference between the .config
and .run
functions in AngularJS. I was using my .config
for setting up routes, but I did have some $on
's for watching route change start and success events.
I then moved some of this code to .run
as I was having some dependency injection problems in .config
.
I finally moved some of this to a CommonAppController
which I have set on my <body>
.
I also had 2 .config
's and it seemed to be running ok, but surely this isn't right?
Can anyone give a little insight on which method to use?