2015-08-13 41 views
0

你好,我正在顯示圖像從兒子對象給下面。在那個兒子對象我有每個圖像的名稱,我需要顯示相應的圖像名稱。如何在圖片庫下添加名稱?

<ion-scroll direction="x" class="item row" id="galleryline1"> 
    <div class="first_row" id="firstrow"> 
     <div> 
      <img ng-repeat="image in allimages" ng-src="{{image.src}}" ng-click="showImages(image.title)" class="image-list-thumb"/> 
     </div> 
    </div> 
</ion-scroll> 

回答

1

只需添加表達式以在ng-repeat內顯示圖像名稱。

<ion-scroll direction="x" class="item row" id="galleryline1"> 
    <div class="first_row" id="firstrow"> 
     <div> 
      <div ng-repeat="image in allimages"> 
       <img ng-src="{{image.src}}" ng-click="showImages(image.title)" class="image-list-thumb"/><br /> 
       <span>{{image.name}}</span> 
      </div> 
     </div> 
    </div> 
</ion-scroll> 
0

調整你的HTML象下面這樣:

<ion-scroll direction="x" class="item row" id="galleryline1"> 
    <div class="first_row" id="firstrow"> 
     <div ng-repeat="image in allimages"> 
      <img ng-src="{{image.src}}" ng-click="showImages(image.title)" class="image-list-thumb"/> 
      <h4 ng-bind="image.name"></h4>  
     </div> 
    </div> 
</ion-scroll> 
0

你的角模板構建錯誤。

您需要對父元素執行角度圖像迭代。像這樣:

<ion-scroll direction="x" class="item row" id="galleryline1"> 
    <div class="first_row" id="firstrow"> 
     <div ng-repeat="image in allimages"> 
      <img ng-src="{{image.src}}" ng-click="showImages(image.title)" class="image-list-thumb"/> 
     </div> 
    </div> 
</ion-scroll> 
0

請試試這個:

<ion-scroll direction="x" class="item row" id="galleryline1"> 
    <div class="first_row" id="firstrow"> 
     <div ng-repeat="image in allimages"> 
      <img ng-src="{{image.src}}" ng-click="showImages(image.title)" class="image-list-thumb"/> 
      <h3 ng-bind="image.name"></h3>  
     </div> 
    </div> 
</ion-scroll> 
0

類似的東西?

<ion-scroll direction="x" class="item row" id="galleryline1"> 
    <div class="first_row" id="firstrow"> 
    <div ng-repeat-start="image in allimages" class="image-list-thumb-img"> 
     <img ng-src="{{image.src}}" ng-click="showImages(image.title)"/> 
    </div> 
    <div ng-repeat-end class="image-list-thumb-note">{{image.name}}</div> 
    </div> 
</ion-scroll>