如何创建下拉筛选结果在AngularJS [英] How to create drop down filter results in AngularJS

查看:96
本文介绍了如何创建下拉筛选结果在AngularJS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有与网页顶部的搜索栏的角度应用。这个搜索栏是一个显示JSON数据数组的子集的过滤器。我想这个过滤器的方式不影响页面(这样剩下的DOM显示其效果,如果过滤器返回一吨的结果,一个下拉框有自己的滚动选项会出现,而不是结果向下推底层的HTML页)。

I've got an Angular app with a search bar at the top of a webpage. This search bar is a filter that displays subsets of a JSON data array. I'd like for this filter to display its results in a fashion that doesn't affect the DOM on the rest of the page (that way, if the filter returns a ton of results, a drop down box with its own scrolling option will appear, as opposed to the results pushing down the underlying HTML page).

我想出了解决的办法是包装在一个div我的 NG-重复和过滤器,并给该分区的绝对在我的CSS的位置。有没有更好的方式来做到这一点?这似乎非常hackish的,而不是非常角给我,但我找不到任何其他的下拉滤波器解决方案。

The solution I came up with was to wrap my ng-repeat and filter in a div and give that div an absolute position in my CSS. Is there a better way to do this? This seems awfully hackish and not very Angular to me, but I can't find any other drop down filter solutions.

推荐答案

有处于工作实施 AngularStrap

  • Demo : http://mgcrea.github.io/angular-strap/#/typeahead#typeaheads
  • Source : https://github.com/mgcrea/angular-strap/blob/master/src/typeahead/typeahead.js

这篇关于如何创建下拉筛选结果在AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆