title: Server rendering with AngularJS
body: <p>i'm developing a webapp in AngularJS (1.5) and Flask, and i'm self-taught.
  My webapplication is not public, so any resource is reserved.</p>
  
  <p>In the first version i manage rendering of the pages by AngularJS through ngRoute and resolve, but i've understood that is a mistake.<br>
  In the second version i'm changing the rendering of the page from Angular to Flask, but every time i've the same problem: Flask render a page, send it to Angular but Angular doesn't show it but instead it show the template in the routing. I've try many cases:</p>
  
  <ul>
  <li>render the login page with Angular and serve just a controller to call the server and load the server rendered page;</li>
  <li>render all with Flask and just a controller in Angular to manage the auth</li>
  <li>use the resolve instead a function in controller for manage the reserved page</li>
  </ul>
  
  <p>For each case i've the same situation: server response with html rendered page, but it's not showed by Angular.</p>
  
  <p>I've found some solutions about my problems: upgrade to Angular2.0 or implement Node.JS, or implement angular-server ... but i would like to avoid to add other components and understand what's wrong.</p>
  
  <p>Part of the Angular routing code</p>
  
  <pre><code>var reserved = {
      name: "reserved",
      params: {aaa:true} }
  var reservedContent = {
      name: "reserved.content",
      url: "/reserved",
      template: "&lt;h1&gt;Angular rendered&lt;/h1&gt;" }
  </code></pre>
  
  <p>and in app.run</p>
  
  <pre><code>$transitions.onBefore({ to: 'reserved.*' }, function(t){
      var AuthService = t.injector().get('appAuth');
      var authorization = appAuth.authorization(t.to().url.substr(1), $rootScope.token);
      authorization.then(function()   {
          $rootScope.resource = t.to().url;
          pySrv.app($rootScope.resource)
          .then(function(data){
              console.log("The html server rendered page: " + data);
              console.log("The Angular template in state" + t.to().template);
              t.to().template = data;
              },
              function(data){
                  console.log("Reject");  }   );
          },
          function(){
              $state.target("403");   }); });
  </code></pre>
  
  <p>I always see "Angular rendered" in the page.</p>