Angular-UI typeahead - 在 v0.04 中工作但不在 v0.11 中 [英] Angular-UI typeahead - Working in v0.04 but not in v0.11
问题描述
I'm essentially trying to the same as in this issue, which was solved with this.
目标是使用 Angular-UI 的 typeahead 功能将模型设置为一个值,同时向使用显示另一个值.这在使用 ui-bootstrap-tpls-0.4.0.js 时工作正常,如 plunker 所示.我在所有其他代码中都使用了 ui-bootstrap-tpls-0.11.0.js,所以我试图让它使用它.问题是它不是.
The goal is to use Angular-UI's typeahead function to set the model to one value, while showing another to the use. This works fine when using ui-bootstrap-tpls-0.4.0.js, as seen in the plunker. I use ui-bootstrap-tpls-0.11.0.js in all of my other code, so I'm trying to get it working with that. The issue is that it isn't.
更改到 v0.11,如在这个 plunker 中所见,导致它在模型和输入中显示相同.(还有另一个错误可能导致它不显示选项,但这对我来说无关紧要)
Changing to v0.11, as seen in this plunker, causes it display the same in the model and in the input. (there's also another error that's causing it not to show the options probably, but that does not matter in my case)
更改输入提示:
typeahead="Unidade.Codigo as Unidade.Nome for Unidade in Unidades
致:
typeahead="Unidade as Unidade.Nome for Unidade in Unidades
产生所需的效果,因为输入显示名称并且模型具有数据.可以在此处查看.我的问题是我真的更喜欢模型只是 Unidade.Codigo,就像第一个例子一样.
Results in the desired effect, as the input shows the name and the model has the data. It can be seen here. My issue is that I would really prefer for the model only to be Unidade.Codigo, as in the first example.
关于如何使用 ui-bootstrap-tpls-0.11.0.js 实现这一目标的想法?
In ideas on how I can achieve this with ui-bootstrap-tpls-0.11.0.js?
按照@mer10z_tech 的建议,更新了 plunker 以使用 AngularJS 1.2.15.可以在这里看到 - http://plnkr.co/edit/FHqC3HLpkmfQx7VBOGKL?p=preview一个>
Updated the plunker to use AngularJS 1.2.15 as suggested by @mer10z_tech. Can be seen here - http://plnkr.co/edit/FHqC3HLpkmfQx7VBOGKL?p=preview
推荐答案
Angular UI bootstrap 需要 AngularJS 1.2.x,已测试 1.2.10 (http://angular-ui.github.io/bootstrap/)
Angular UI bootstrap requires AngularJS 1.2.x, tested with 1.2.10 (http://angular-ui.github.io/bootstrap/)
如果您将 Plunker 更改为使用 AngularJS 1.2.10,它应该可以工作.
If you change your Plunker to use AngularJS 1.2.10 it should work.
这篇关于Angular-UI typeahead - 在 v0.04 中工作但不在 v0.11 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!