AngularJS在一个div预输入搜索结果 [英] AngularJS typeahead search results in a div

查看:158
本文介绍了AngularJS在一个div预输入搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是引导的预输入的文字输入也有一个按钮,弹出一个受欢迎的结果酥料饼。

I'm using bootstrap's typeahead for a text input that also has a button that pops a popular results popover.

我想的预输入的功能,只有结果列表将在不同的div进行显示(在酥料饼内,而不是下的文本输入)。

I want the functionality of the typeahead, only that the results list will be displayed in a different div (inside the popover instead of under the text input).

有没有办法来设置的预输入搜索结果中的容器? (如酥料饼的小部件包含一个容器选项)

Is there a way to set the 'container' for the the typeahead search results? (for example popover widget contains a 'container' option)

事情是这样的:

Text Field    Button          popover
________________________________________________________
|   Search...  | B |  Typeahead1    Popular Searches:  |
|--------------|---|  Typeahead2    Src1               |
                   |  Typeahead3    Src2               |
                   |  ....          ...                |
                   |___________________________________|

(本来更快的在Photoshop绘制,但呃...)

(would have been quicker to draw in photoshop but eh...)

一个很好的解决方案有什么想法?我想到了一些方法:修改/延长预输入插件或使用隐藏的文本输入。我可以去jQuery的自动完成,而不是可能。任何其他(更好)的建议吗?

Any thoughts of a good solution? I thought about a few ways: Modify/extend the typeahead plugin or use a hidden text input. I could go for jquery's autocomplete instead maybe. Any other (better) suggestions?

请注意:我使用jQuery + angularjs +引导

Note: I'm using jquery+angularjs+bootstrap

推荐答案

据我知道,从的预输入指令的code = http://angular-ui.github.io/bootstrap/相对=nofollow> http://angular-ui.github.io/bootstrap/ (我那种知道,因为我已经:-)写它),你将无法做你只能通过配置询问这里。

As far as I know the code of the typeahead directive from http://angular-ui.github.io/bootstrap/ (and I kind of know it since I've written it :-)) you won't be able to do what you are asking here only by configuration.

您需要将其叉,适应您的需求。它应该是pretty简单。随意如果你觉得什么应该是指令内的变化,使其更容易扩展开GitHub的问题。

You will need to fork it and adapt for your needs. It should be pretty straightforward. Feel free to open a GitHub issue if you feel like anything should be change inside the directive to make it easier to extend.

这篇关于AngularJS在一个div预输入搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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