1

I am new to Angular, maybe is a fool question. I have a result from my AngularJs and I return an Array of values:

This is the code:

$scope.searchTitle = function () {

  $http.post('/svn/cms2/branches/create_function/cms/includes/find.php', { 
    name_title: $scope.title 
  })
  .success(function (result) {
    console.log(result);
    $scope.resultName = result;
    $scope.ok = "we post";
  })
  .error(function (data, status) {
    console.log(data);
  });
};

And now i have the resultName in the html and i can see the result if i do this:

<p>{{ resultName[0].article_titile }}</p>

Question:

I want to display all the array. How can I display all?

P.S.:

I use this and it is not work

<tr ng-repeat="i in [3] | toRange" >
   <td>{{ resultName[i].article_titile }}</td>
</tr>

But is not working

2
  • <tr ng-repeat="i in resultName | toRange" > <td>{{ i.article_titile }}</td> </tr> reference: w3schools.com/angular/ng_ng-repeat.asp Commented Sep 17, 2017 at 11:39
  • It does not display again. my result in Dev tools is: (2) [{…}, {…}] And in this {...},{...} is my result of all array. Commented Sep 17, 2017 at 11:47

1 Answer 1

2

You need to use an iterator variable (e.g. result) with your resultName array in your ng-repeat:

<tr ng-repeat="result in resultName | toRange" >
   <td>{{ result.article_titile }}</td>
</tr>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.