OK, so first and most important thing you have to acknowledge is a
very simple rule: your controller is supposed to decide what, when and
why happens. If something is supposed to happen - this is because
nothing but your controller wants it. What about view? View is
supposed to blindly follow. It is not about deciding or taking
control. It is just a reflection of the state of the application.
Why this is so important is out of the scope here, but having that in
mind is going to save your application from being a spaghetti.
Now, your specific problem. Your controller loads employees. I assume
you are calling a service, that service returns a promise, you attach
a "then" function which fires after data are downloaded and available
locally. There is nothing special in a case you want something to
happen after that, so you can launch another stuff in another "then"
of the said promise, or just add more lines of "things to happen"
inside what you already have. Remember: your view is supposed to
follow. You controller can issue hints like: "something has happened"
event or scope.something = "I did this or that", so your view can
follow, but not the other way. You are not going to wait for some kind
of "I AM RENDERED" events, because your controller does not give a
sh** about that.
Again: controllers are supposed to work without any view being
attached to them. Once you start troubling your controller with stuff
it SHOULD never care, like display events, you are on slippery slope.
Your app will become a bundle of scripts. If you want to crate and
support a bunch of scripts - then you better stop using Angular,
because it will get in your way.
Regards,
Witold Szczerba
2013/10/15 mahesh shinde <
mahesh...@gmail.com>: