title: How to fetch values from array in javascript +angularjs
body: <p>I want to get values from array index in javascript +angularjs like ng-repeat but in my controller</p>
  
  <pre><code>Array[0]
    0: Object
       class:"text-area"
       text: "Arif#2:hi bro"
       time_stamp: 1484644646user_
       chat_img: "images/noimage.jpg"
      __proto__: Objectlength: 1__proto__: Array[0]
  </code></pre>
  
  <p>Now i want to print class name like "class=text-area" and this will be a loop
  Thanks</p>
  
  <p>Here is my code</p>
  
  <pre><code> $scope.p=get_chat_history(); this function give me array
   console.log('key',$scope.p);
  </code></pre>
  
  <p>Sorry fo all that i am very beginner 
  I add some more detail </p>
  
  <pre><code>function get_chat_history() {
          var data = [];
          var time_stamp = '';
          $timeout(function () {
              $scope.time_stamp = window.localStorage.getItem('time_stamp');
  
          }, 3000);
          console.log('time_stamp', $scope.time_stamp);
          if (!$scope.time_stamp) {
              $scope.time_stamp = Date.now();
          }
          $http({
              url: "https://testing.twodegrees.io/chat/history/" + my_chat_id + "/" + my_chat_friend_id + "/" + $scope.time_stamp,
              headers: {
                  'X-TWO_DEGREE-APP_ID': 'test_Anonymous_786',
                  'X-TWO_DEGREE-APP_TOKEN': actoken
              },
              method: 'GET'
          }).then(function mySucces(success_res) {
  
  
              // console.log(' history data',success_res);
              var chat_images_images = [];
              for (var p = 0; p &lt; success_res.data.chats.length; p++)
              {
                  console.log('p', p);
                  chat_images_images[p] = [];
                  var message_body = success_res.data.chats[p].body;
                  var myJSON = JSON.parse(message_body);
                  var time_stamp = success_res.data.chats[p].time_stamp;
                  var myJSON2 = JSON.parse(time_stamp);
                  if (myJSON.sname == my_name) {
                      var class_name = 'text-area2';
                  } else {
                      var class_name = 'text-area';
                  }
                  //console.log('time_stamp',myJSON2);
                  if (p == 0) {
                      window.localStorage.setItem('time_stamp', myJSON2);
                  }
  
                  var newtest = {
                      text: myJSON.text,
                      class: class_name,
                      user_chat_img: "images/noimage.jpg",
                      time_stamp: myJSON2
                  }
                  // console.log('chat history',myJSON);
                  data.push(newtest);
  
              }
              // console.log('chat history',data);
  
          });
  
          var urle = "https://testing.twodegrees.io/chat/history/" + my_chat_id + "/" + my_chat_friend_id + "/" + $scope.time_stamp;
  
          console.log('url history', urle);
  
          return data;
  
      }
  </code></pre>
  
  <p>this function send me a array and i want to use this </p>