title: Angular JS ajax and php data parsing errors
body: <p>Basically I am facing a problem, I have taken multiple files from HTML input. When the submit button is clicked , a dynamic array of those files paths has been made , and then I JSON encode that array, which is dynamically made, and insert it in a database table. Till the database insertion it is fine, but the problem occurs when i retrieve that array, using angular js http calls, that array is treated as a string, then I make it JSON.parse to convert it into array, so the $scope.im is basically that array which contains the parsed array.</p>
  
  <p>Now,I am making html elements dynamically, they are populated with respect to the response from the ajax call, as much records i have in the database that much elements are made, but here in each element there is an image place, where i want to put the very first image on each element from the sub arrays. like on first element i want to put image from sub array 1 0th element files/file/img1.jpg, on second element i want to put image from sub array 2 0th element files/file1/img1.jpg and so on... </p>
  
  <p>these are the elements made dynamically, the transparent one the image section.
  <a href="https://i.stack.imgur.com/l6Euc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l6Euc.png" alt="enter image description here"></a></p>
  
  <p>This is how I parse the array. 
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$http({
       method:"POST",
       url:"files.php",
       data:$.param({
              tot_data:true
       }),
       headers:headers
      }).then(function(res){
       $scope.d = res.data;
          $scope.im=[];
  
         for(var i=0; i&lt;$scope.d.length; i++){
         $scope.im = JSON.parse($scope.d[i].imgs);
            console.log($scope.im[i]);
         }
  
      });</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>This is the result I get on console:</strong> 
  <a href="https://i.stack.imgur.com/JGw5r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JGw5r.png" alt="And all the time, I faced failure"></a></p>
  
  <p><strong>But when I put it in the html</strong>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;p&gt;{{im[0]}}&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Still I get the same path on each element, not as the result shown on console</strong>
  <a href="https://i.stack.imgur.com/6iULl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6iULl.png" alt="enter image description here"></a></p>