2016-06-29 4 views
0

私は角度のテーブルを塗りつぶしていますが、私の配列が空であるというエラーメッセージを表示できるようにしたいのですが、そのリストを持つときに解決策を見つけることができますが、これをテーブルに変換します。空のテーブルのメッセージ角度

助けていただけたら幸いです!

コード:

<table class="datatable"> 
    <tr> 
    <th><input ng-model="allSelected" ng-change="selectAll()" type="checkbox"></th> 
    <th>Image</th> 
    <th> 
     <div class="headerButtons"><a ng-click="order('name')">Name<i class="material-icons md-18">swap_vert</i></a></div> 
    </th> 
    <th> 
     <div class="headerButtons"><a ng-click="order('type')">Type<i class="material-icons md-18">swap_vert</i></a></div> 
    </th> 
     <th> 
     <div class="headerButtons"><a ng-click="order('type')">Dimensions<i class="material-icons md-18">swap_vert</i></a></div> 
    </th> 
     <th> 
     <div class="headerButtons"><a ng-click="order('type')">Media Linkage<i class="material-icons md-18">swap_vert</i></a></div> 
    </th> 

    </tr> 

    <tr ng-repeat="file in (filteredImageData = (imageData | filter:search | filter:myFilter))"> 
    <context-menu ng-init="file.hidden = true" owner="file" menu-data="contextMenuFields"></context-menu> 
    <td><input ng-model="file.selected" type="checkbox"></td> 
    <td><div ng-if="file.type == 'image'"> 
     <a ng-click="openCarousel(file,$index)"><img ng-src="http://XXXX/{{file.url}}" width="65" height="65" get-image-resolution="file.size"></div> 
     <div ng-if="file.type == 'video'"> 
     <a ng-click="openCarousel(file,$index)"><i class ="material-icons md-24">videocam</i ></div> 
     <div ng-if="file.type == 'audio'"> 
     <a ng-click="openCarousel(file,$index)"><i class="material-icons md-24">volume_up</i></div> 
     </td> 
     <td> 
     {{file.name}} 
     <div class="dropdown"><a ng-click="contextMenuFields.show($event,file)"><i class="material-icons">more_horiz</i></div></td>   

    <td>{{file.type}}<i class="greyedOut"> {{file.name | getextension}}</i></td> 
    <td>{{file.size.x}}<i class="greyedOut"> x</i> {{file.size.y}}<i class="greyedOut"> px</i></td> 
    <!--<td>blurp{{getRes(http://XXXX/{{file.url}})}}</td>--> 
    <td>{{file.folder}}</td> 

    <!--<td>{{file.type}}{{getExtension(file.name)}}</td>--> 

    </tr> 

</table> 

答えて

1

ng-ifを利用するようにコードを置き換えます。以下は使用できるサンプルコードです:

<tr ng-if="(!filteredImageData || filteredImageData.length < 1)"> <td colspan="6">There are no records to show</td> </tr> <tr ng-if="filteredImageData" ng-repeat="file in (filteredImageData = (imageData | filter:search | filter:myFilter))">

+0

乾杯!まだ私は次のことをしようとしているときにはまだバギー:

何か考えているのですか? –

+0

下記のコードを試してください: '

' これがあなたの問題を解決することを願っています: – seekers01

関連する問題