2014-12-05 31 views
0

1.3.5角,角的UI,引導0.12.0角UI的預輸入使modelValue到輸入的viewValue

表達式像

typeahead="state.postcode as state.address for state in states | filter:$viewValue" 

不再正常工作 - 輸入的viewValue總是與填充modelValue(state.postcode - 而不是在這種情況下state.address)

小提琴例如 http://jsfiddle.net/s7yyv4by/

我是否英里ss的東西或這是一個錯誤?它的工作原理在正常角度的UI 0.4.0(見http://jsfiddle.net/dLu0oqn1/

編輯:類似的問題:Angular-UI typeahead - Working in v0.04 but not in v0.11

+0

請問您能解釋究竟是什麼錯誤嗎?因爲我正在檢查你的小提琴,並且每件事似乎都是正確的... – Kutyel 2014-12-05 13:47:19

+0

當你選擇'曼徹斯特'時 - 輸入'typeahead'標籤應該顯示'曼徹斯特',但它顯示'M1'(在模型中的值) – mowMiStefan 2014-12-05 14:07:17

+0

那麼當前你的typeahead顯示state.postcode(並且你綁定到模型) - 因此顯示'M1'。按照預期,將狀態改變爲state.address以顯示'Manchester'。 – doldt 2014-12-05 14:36:12

回答

2

你可以這樣http://jsfiddle.net/s7yyv4by/2/

基本上設置selPcode整個對象接近它。然後訪問postcode作爲selPcode的財產。

postcode <input type="text" ng-model="selPcode.postcode" /> 
typeahead <input type="text" ng-model="selPcode" typeahead="state as state.address for state in states | filter:{address:$viewValue}" typeahead-editable="false" />