title: Pass php variable/array data to angular js
body: <p>I am using php database connectivity with "$row" as an array that stores name as a field in it .But after lots of searching i dint get how to pass php variable in angular js 
  here's the code ,I am trying to achieve.how is it possible i am new to this your help will be appreciated.</p>
  
  <pre><code>&lt;?php
  
  $con = mysqli_connect('localhost','root','','practice');
  
  if (!$con) {
      die("couldnt connect". mysqli_error);
  }
  
  $q= "select * from test";
  $result= $con-&gt;query($q);
  
  if ($result-&gt;num_rows&gt;0) {
  
      while ($row = $result-&gt;fetch_assoc()) {
  
          echo $row['name']."&lt;br&gt;";
  
      }
  }
  
  print_r($result);
  
  echo json_encode($result);
  
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.js"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;ul ng-init="names = &lt;?php echo htmlspecialchars(json_encode($row)); ?&gt;"&gt;
  &lt;li ng-repeat="x in names"&gt;
     &lt;p&gt;{{x.name}}&lt;/p&gt;
  &lt;/li&gt;
  &lt;/ul&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>