I have a service that will auth my user and get a token. I'm consuming it on the mainController which is appended to the body (index.html)
That should be the frist thing to do in my app.
In my index.html are 2 directives (which are consuming a service that needs that token)
<body ng-controller="mainController">
<div class="row" ng-if="token">
   <div directive1></div>
 </div>
 <div class="row" ng-if="token">
    <div directive2></div>   
  </div>
</body>
It throws an error because the token is not yet defined when the directives are used.
 angular.module('app').directive('directive1', function () {
  return {
  templateUrl: directive1.html,     
  controller: function (thingsService) {
        //
   }
 }
});
I've got a solution based on ng-if == token on html directive call (index.html)
This does the job, but I'm not really satisfied. Is there a better solution? I've seen a solution of watches already.
 
     
    