我試圖過濾下面的代碼項目列表,在網頁上的角度js罰款很好,但我們不能指望Ionic現在可以工作嗎?離子ng-repeat返回一個undefined
<ion-list *ngIf="items.length">
{{items[0].title}}
<ion-item ng-repeat="item in items | filter:searchLog">
{{item == undefined}}
<!--<ion-icon name="clipboard" item-left></ion-icon>
<h2><b>Title: {{item.title}}</b></h2>
<h3><b>Caller: {{item.caller.name}} - {{item.caller.number}}</b></h3>
<h3><b>Location: {{item.caller.location}}</b></h3>
<h3><i>Dispatcher: </i>{{item.dispatcher.name}} at {{item.timeStamp}}</h3>
<h3><b>Dropped: {{item.canceled}}</b></h3>
<h3 style="white-space: normal;"><i>Details:</i> {{item.details}}</h3>-->
</ion-item>
</ion-list>
這是我的屏幕顯示:
car out of gas
true
對於我的生活我不明白這一點,因爲如果我打印{{ items[0].title }}
它在重複表工作正常,這意味着它不給我這個item
從ng-repeat調用返回的對象。什麼是更加古怪的是,*ngFor
的作品,但我不能過濾它:-(請幫助
TL; DR:NG-重複的角度將返回一個未定義的對象
是什麼'searchLog'好像過濾器返回0,結果 – Claies
的字符串由頂部的bos設置。我嘗試將它設置爲有效搜索(例如t第一個項目的itle,但它什麼也沒做 –
好吧,如果你刪除了'filter'子句,'ng-repeat'中是否有值?因爲它看起來應該是這樣,如果'* ngFor'正在工作.... – Claies