2015-08-31 67 views
0
<tr data-ng-repeat="myTrack in myTrackList"> 
<td class="project-status" data-ng-switch="myTrack.opened"> 
             <span data-ng-switch-when="true" class="label label-primary">Active</span> 
             <span data-ng-switch-when="false" class="label label-default">Inactive</span> 
            </td> 
            <td class="project-title"><a 
             id="{{myTrack.trackId}},{{myTrack.file.fileId}}" 
             href="getDocumentByFileId?fileId={{myTrack.file.fileId}}&trackId={{myTrack.trackId}}">{{myTrack.trackName}}</a> 
             <br /><small>Description: {{myTrack.description}}</small> 
             <br /> <small>Created: {{myTrack.createdTime}}</small></td> 
            <td class="project-people" colspan="2"> 
             <div class="project-people" ng-repeat="persons in myTrack.personTrack">           
              <a href=""><img alt="image" title="persons.firstName" 
               class="img-circle" src="persons.profilePictureUrl"></a> 
             </div> 
            </td> 
            <td class="project-actions"><a href="#" 
             class="btn btn-white btn-sm"><i class="fa fa-folder"></i> 
              View </a></td> 
           </tr> 

我拿到了对象列表,在单个对象中有一组用户及其个人资料图片。我在ng-repeat中使用了ng-repeat来重复从对象列表中设置的用户,但是我的内部ng-repeat无法正常工作。请帮帮我。不能在angularjs代码下工作

+0

请问您可以添加一个plunker – Radu

+0

我想从angularjs中的对象列表中检索集合。并且我无法添加运行程序,因为我正在使用hibernate从数据库中提取用户 –

+0

我的答案表单波纹管帮助了您吗? – Radu

回答

0

至于波纹管代码:

<div class="project-people" ng-repeat="persons in myTrack.personTrack">           
     <a href=""><img alt="image" title="persons.firstName" class="img-circle" src="persons.profilePictureUrl"></a> 
    </div> 

的浏览器不知道你是采用了棱角分明的js变量标题或SRC。所以你需要。

<div class="project-people" ng-repeat="persons in myTrack.personTrack">           
      <a href=""><img alt="image" ng-attr-title="{{persons.firstName}}" class="img-circle" ng-src="{{persons.profilePictureUrl}}"></a> 
     </div> 

所以当你想使用angular js for tags时,你需要包含ng标签。

+0

上面的代码工作正常。感谢帮助 –