title: Search for character in string, within an loop
body: <p>I have a string containing 3 different types of characters with a special meaning. I have an loop that iterates 160times, and for each iteration of the loop, I want to check the current character in the string. Thus, if it is the first iteration of the loop, I want to check the first position in the string and check what kind of character it is. If it is the second iteration, I want to check the second position in the string etcetc.</p>
  
  <p>How can I do this in AngularJS?</p>
  
  <p>I'm returning the string from my php backend.</p>
  
  <p>Here is the solution in PHP, but I want it to work with AngularJS:</p>
  
  <pre><code>&lt;?php
  $string = "........####........
  .....##..##.........
  ......#.......&amp;&amp;&amp;&amp;&amp;&amp;
  ......&amp;&amp;&amp;&amp;&amp;&amp;........
  .&amp;..&amp;&amp;&amp;....%..##.&amp;&amp;&amp;
  &amp;&amp;......##......&amp;&amp;&amp;.
  ....................
  .#..................";
  
  $k = 1;
  for($j = 1; $j &lt;= 8; $j++)
  {
      echo "&lt;tr&gt;";
      for($i = 1; $i &lt;= 20; $i++)
      {   
          if($string[$k] == "#")
          {
              echo "&lt;td id='$k'&gt;#&lt;/td&gt;";
          }
          elseif($string[$k] == "&amp;")
          {
              echo "&lt;td class='click' val='water' id='$k'&gt;&amp;&lt;/td&gt;";
          }
          else
          {
              echo "&lt;td class='click' id='$k'&gt;&lt;a href='#'&gt;&lt;/a&gt;&lt;/td&gt;";
          }
          $k++;
      }
      echo "&lt;/tr&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>Here is my controller in AngularJS:</p>
  
  <pre><code>gameApp.controller("gameCtrl", function($scope,$http,link,$location) {
      $scope.trr = [1,2,3,4,5,6,7,8];
      $scope.tdd = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
      $scope.getMonsters = "1";
      var map;
  
      $http.post("lib/action.php", {monsters: $scope.getMonsters}).success(function(data) {
          map = data;
          console.log(map);
      });
  
      if(link.user) {
          /*$scope.message = "fisk";
          console.log(link.user);*/
      } else {
          /*$scope.message = "Ledsen fisk";
          console.log("Är inte satt");*/
      }
  });
  </code></pre>
  
  <p>Here is my PHP-backend:</p>
  
  <pre><code>&lt;?php
      session_start();
      include("classes.php");
      $data = file_get_contents("php://input");
      if(isset($data))
      {
          $objData = json_decode($data);
          $login = new User();
          echo $login-&gt;doLogin($objData-&gt;username, $objData-&gt;password);
  
          if(isset($objData-&gt;monsters)) 
          {
              $string = "........####.............##..##...............#.......&amp;&amp;&amp;&amp;&amp;&amp;......&amp;&amp;&amp;&amp;&amp;&amp;.........&amp;..&amp;&amp;&amp;....%..##.&amp;&amp;&amp;&amp;&amp;......##......&amp;&amp;&amp;......................#..................";
              echo $string;
          }
      }
  </code></pre>
  
  <p>Here is my HTML with my looop:</p>
  
  <pre><code>&lt;div ng-controller="gameCtrl"&gt;
      &lt;table&gt;
          &lt;tr ng-repeat="row in trr"&gt;
          &lt;td ng-repeat="r in tdd"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Anyone who can help me?</p>
  
  <p>?></p>