2015-08-31 72 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

上面的代碼工作正常。感謝幫助 –