ng-reeat中的角度过滤器——当没有匹配结果时显示消息
Angular filter in ng-repeat -- show message when no matching results
我有过滤功能,可以根据用户的输入和日期比较来过滤模型。我想在该筛选器未返回结果时显示一条消息。我已经看到了这个问题的其他答案,但我似乎无法让它们发挥作用。
以下是我如何进行ng重复设置:
<div ng-repeat="docs in casedocs | filter: filterDocuments |
orderBy: userSort : userSortDirection ">
<div style="float:left;padding-right:4px;" class="documentRadios">
<input type="radio" ng-model="docviews[0].docID"
ng-show="typeOfLaw != 'CV'" value="{{docs.DocID}}"
ng-change="loadDocument(1,
'{{docs.Description}}', {{docs.DocID}})" />
<input type="radio" ng-model="docviews[1].docID"
ng-show="typeOfLaw != 'CV'" value="{{docs.DocID}}"
ng-change="loadDocument(2,
'{{docs.Description}}', {{docs.DocID}})" />
</div>
<div class="documentTitle">
<a href ng-click="loadDocument(1,
docs.Description, docs.Doc_ID)">
{{docs.Description}}
</a>
<span class="documentFilingDate">
({{docs.DocFilingDate}})
</span>
</div>
<div class="documentIcons">
<a href="docview/{{docs.DocID}}" target="_blank">
<span class="glyphicon glyphicon-new-window white smaller">
</span>
</a>
<span ng-show="docs.Image_Type_ID == 3" class="glyphicon
glyphicon-search white smaller"></span>
<span ng-show="docs.Security_Level > 0" class="glyphicon
glyphicon-lock white smaller"></span>
<span ng-show="docs.QC_Review_Status == 1" class="glyphicon
glyphicon-ok white smaller"></span>
</div>
<div style="clear:both;"></div>
</div>
<div class="col-sm-8">
<span class="notFound white">{{noDocumentsMsg}}</span>
</div>
</div>
根据我发现的例子,我应该更改ng重复声明如下:
<div ng-repeat="docs in casedocs = (doc | filter: filterDocuments)
| orderBy: userSort : userSortDirection ">
然后使用基于CCD_ 2的CCD_。我看到的示例没有orderBy语句。我在这里做错了什么?
前面给出的答案示例:
假设您的数据在$scope.casedocs
中,请尝试:
<div ng-repeat="docs in filteredCasedocs = (casedocs | filter: filterDocuments | orderBy: userSort : userSortDirection)">
<!-- your code -->
</div>
<div ng-show="!filteredCasedocs.length">None avaialble</div>
相关文章:
- 奇怪的Javascript结果
- Javascript(jQuery)给了我奇怪的结果
- Ajax聊天消息重复而不仅仅是更新
- JSONP请求返回结果,但也触发error_callback
- 如果localstorage为空,则显示欢迎消息
- 如果文本筛选器在ng重复中未返回结果,则显示消息
- 显示无结果消息灵活
- 角度:当没有结果时显示一条消息 ng-重复角度 ?(具体情况)
- 在网格视图中显示不同的消息,用于没有绑定数据和未检索到结果
- 当没有结果返回 JavaScript 搜索时显示消息
- ng-reeat中的角度过滤器——当没有匹配结果时显示消息
- 我想在获取结果时显示一条消息
- 如果无法在指定时间内从服务器检索结果,则弹出警告消息
- 为“未找到结果”添加自定义消息
- 在“没有结果”的情况下;在Express场景中,我如何将选择错误消息输出到浏览器而不显示空数组[]
- 如何根据从三个子控制器获得的结果在父控制器中显示动态消息
- 更好的发出Socket的结构.IO消息并等待结果
- 如果结果为0,则显示消息
- 如何使用angular js动态更改网页上各种结果的状态消息
- 使Javascript RSA消息加密给出相同的结果