title: Run function before ng-init in AngularJS
body: <p>I have a function <code>checkLogin()</code> which sets a variable in a service. This is always run in <code>app.run(...)</code>. In one function called by ng-init I want to use this variable to make a call to my backend. The problem is that ng-init is called before, so the call to my backend sends an <code>undefined</code> variable. What should I do to make sure that <code>checkLogin()</code> is always called first?</p>