Having two sets of values in $scope.result in AngularJS
<p>I use the following code to display the result of a research :</p>

<pre><code>&lt;table&gt;
    &lt;tr ng-repeat="x in result"&gt;
    &lt;td&gt;&lt;div ng-click="display(x)"&gt;{{x}}&lt;div&gt;&lt;/td&gt; 
    &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>I use the following <code>$http.post</code> query to set values to <code>$scope.result</code>:</p>

<pre><code> $http.post('server.php', {"data" : $scope.keywords, "serverQuery" : "chercherAssociation"})
 .success(function(data, status) 
 {
     $scope.result = data;
 }
</code></pre>

<p>However, I need to change the code to something like this :</p>

<pre><code>&lt;table&gt;
    &lt;tr ng-repeat="x in result"&gt;
        &lt;td&gt;&lt;div ng-click="display(x.id)"&gt;{{x.name}}&lt;div&gt;&lt;/td&gt; 
    &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>So <code>$scope.result</code> will need to have two sets of values : <strong>id</strong> and <strong>name</strong>.
How do I do that ?</p>

<p>I have tried the following :</p>

<pre><code>$scope.result.name = ...
$scope.result.id = ...
</code></pre>

<p>and some variations, but it didn't work (nothing show up in the <code>&lt;table&gt;</code>).</p>