如何将外键更改为名称?

时间:2015-06-28 19:53:47

标签: angularjs

我在控制器中有这段代码

      ScheduledInteractions.notComplete({},function(response)
      {$scope.pendingContacts=response}
      );

我的服务有这个:

      app.factory('ScheduledInteractions', function ($resource) 
      {
       return $resource('/api/ScheduledInteractions/:id', {}, {
       show: { method: 'GET',  params: {id: '@id'} , isArray: false},
       update: { method: 'PUT', params: {id: '@id'} },        
       findLead: { url:'/api/ScheduledInteractions?filter={"where":{"leadId"::id}}', method: 'GET',  params: {id: '@id'} , isArray: true},        
       notComplete: { url:'/api/ScheduledInteractions?filter={"where":{"isCompleted":"false"}}', method: 'GET', isArray: true},        
       delete: { method: 'DELETE', params: {id: '@id'} }        
         })
      });

它将返回包含客户ID的数据。在我的HTML中我有类似

的东西
      <tr ng-repeat="p in pendingContacts"><td> {{p.leadId}}</td><td> {{p.notes}}</td></tr>

将ID转换为潜在客户名称的最佳方法是什么?

编辑:样本回复

  

createdAt:&#34; 2015-06-28T16:27:11.309Z,&#34;日期:   &#34; 2015-06-10T04:00:00.000Z&#34;,id:22,isCompleted:false,isDeleted:   false, leadId:545 ,注意:&#34;需要确认&#34;,输入:&#34; email&#34;,   updatedAt:&#34; 2015-06-28T16:27:11.309Z&#34;,userId:17

0 个答案:

没有答案