3

I am trying to have angular validation on my page.

I have a plunkr here that shows a normal select that behaves the way you would expect. It starts off not selected, when you select an option and then go back to the blank option, the error shows up:

http://plnkr.co/edit/SEgsPRaRCjVnpV0PGxJf?p=preview

However, if I change that to a ui-select2, it automatically makes it dirty and shows the error message on load. Any thoughts on a workaround for this? thanks in advance!

4

1 回答 1

0

这是 angular-ui 和 select2 的一个已知问题。似乎它已经解决了,但我从来没有让它工作。

就我而言,我刚搬到 selected.js。

我找到了这篇文章,经过一些小改动后,我得到了以下指令:

https://gist.github.com/royts/5894780

它工作得很好,并且在初始化后不会将表单标记为脏,而且看起来更好(您仍然可以看到选择的选项,但它们很棒,换行看起来更好)。

于 2013-07-11T10:41:39.767 回答