I initialize some variables of an AngularJS controller on the server side using ng-init 
/* in my server side View */
<div ng-controller="myController" ng-init="myFoo=@myFoo;myBar=@myBar">...</div>
/* in the myApp.js */
app.Controller("myController", function(){
  // wait until myFoo and myBar are initialized, 
  // once defined, perform other tasks
  $scope.$watch("myFoo", function(n,o){}); //?
  $scope.$watch("myBar", function(n,o){}); //?
  // other actions, depending on myFoo and myBar
  for(i=0; i<myFoo; i++) { console.log(myBar); }
});
I need to ensure that when angularjs reaches the for cycle myFoo and myBar variables are already initialized. 
Is there a way of doing it (without using strange things like magic=1500 $timeout(magic))?
Here is a CodePen
var app = angular.module("myApp", []);
app.controller("myCtrl", ['$scope', '$timeout', function($scope, $timeout) {
  $scope.myFoo = false;
  $scope.myBar = false;
  
  $scope.$watch("myFoo", function(n,o){
    //$timeout(null,1500);    
    console.log("watch > myFoo from: "+o+" to "+n+"; >"+$scope.myFoo);
  });
  $scope.$watch("myBar", function(n,o){
    //$timeout(null,500);
    console.log("watch > myBar from: "+o+" to "+n+"; >"+$scope.myBar);
  });
  
  console.log("> Main thread: myFoo is: " + $scope.myFoo);
  console.log("> Main thread: myBar is: " + $scope.myBar);
 }]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
  
  <div  ng-init="myFoo=true;myBar=true"></div>
</div>
as we can see from the execution of that code
> Main thread: myFoo is: false
> Main thread: myBar is: false
watch > myFoo from: true to true; >true
watch > myBar from: true to true; >true
The main thread reaches the variables BEFORE its initialization... Bad !