title: AngularJS 2-way binding in partial templates & refresh woes
body: <p>I have a partial template loaded outside of my <code>ng-view</code>, with it's own controller. It looks like this.</p>
  
  <p><strong>Base template</strong></p>
  
  <pre><code>&lt;html ng-app="myApp"&gt;
     ...
     &lt;div ng-include src="'myPartial.html'"&gt;&lt;/div&gt;
     ...
     &lt;div ng-view&gt;&lt;/div&gt;
     ...
     &lt;!-- script files go here --&gt;
     &lt;script src="angular.js"&gt;&lt;/script&gt;
     &lt;script src="angular-route.js"&gt;&lt;/script&gt;
     &lt;script src="myPartialController.js"&gt;&lt;/script&gt;
     &lt;script src="myApp.js"&gt;&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Main app script (<code>myApp.js</code>)</strong></p>
  
  <pre><code>var app = angular.module('myApp', ['myPartialController', 'ngRoute']);
  app.config(function($routeProvider) {
      .when('/myUrl', {
              templateUrl: 'myPartial.html',
              controller:'myPartialController',
              reloadOnSearch: true
          })
  });
  </code></pre>
  
  <p><strong>Partial template (<code>myPartial.html</code>)</strong></p>
  
  <pre><code>&lt;div class="container-fluid" ng-controller="myPartialController"&gt;
      {{myVariable}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Now, inside the controller, I am reading a value from sessionStorage, doing a bunch of parsing, data manipulation and so on, and then finally setting the result to a <code>$scope</code> array variable.</p>
  
  <p><strong>Partial controller (<code>myPartialController.js</code>)</strong></p>
  
  <pre><code>angular.module('myPartialController', [])
  
  .controller('myPartialController', ['$scope', '$rootScope', '$window', function($scope, $rootScope, $window) {
      // some parsing, data manipulation, what have you's
      // and finally set the result array to myVariable.
      $scope.myVariable = myVariable;
  }]);
  </code></pre>
  
  <p>Now when the partial is loaded, it shows just an empty array (<code>[]</code>). When I refresh the page, the correct array is displayed.</p>
  
  <p>Essentially, 2-way binding isn't working. What am I missing?</p>