title: how to pass global variable in view to controller angularjs
body: <p>I'm tring to send backend by ejs to the frontend , controller of angularjs </p>
  
  <p><strong>app.js</strong>
  <br>
  i pass data to view/indexcontens.</p>
  
  <pre><code>var users = [
    {
      name: 'john',
      email: 'john@email.com'
    },
    {
      name: 'peter',
      email: 'peter@email.com'
    },
    {
      name: 'max',
      email: 'max@email.com'
    }
  ];
  
  app.get('/partials/indexContents.html', function(req, res) {
    res.render('partials/indexContents', {users:users})
  });
  app.get('/partials/about.html', function(req, res) {
    res.render('partials/about')
  });
  </code></pre>
  
  <p><strong>views/partials/indexContents</strong>
  <br> i made it global variable.</p>
  
  <pre><code>  &lt;div&gt;
      &lt;h3&gt;home&lt;/h3&gt;
      &lt;p&gt;wecome to my blog. I hope you enjoy the content!&lt;/p&gt;
      &lt;ul&gt;
          &lt;li ng-repeat="post in blogposts"&gt;{{post}}&lt;/li&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
          &lt;script&gt;
               users = "&lt;%=abc=users[0].name%&gt;";
          &lt;/script&gt;
  </code></pre>
  
  <p><strong>public/js/contollers.js</strong><br/> trying to get the global variable</p>
  
  <pre><code>var app= angular.module('blog',['ngRoute']);
  
  app.config(function($routeProvider) {
      //set up routes
      $routeProvider
      .when('/home',{
          templateUrl:'partials/indexContents.html',
          controller:'SimpleController'
      })
      .when('/about',{
          templateUrl:'partials/about.html',
          controller:'AboutController'
      })      
      .otherwise({
          redirectTo:'/'
      });
  });
  
  
  app.controller('SimpleController', function($scope){
  
      $scope.blogposts=[
      'blog post1',
      'blog post2',
      window.users
      ];
  }); 
  
  
  app.controller('AboutController', function($scope){
      $scope.name="graum";
      $scope.bio="i just made it";
  });
  </code></pre>
  
  <p>but it only display blank instead of 'john'.</p>
  
  <p>Please give me a solution, thank you </p>