2016-01-27 48 views
1

我在多個下拉菜單中使用AngularStrap的Typeahead指令,有時顯示值顯示爲選定值。AngularStrap Typeahead隨機選擇顯示值而不是模型值

例如,如果我只想在輸入字段中顯示數字作爲選定值,有時候會同時選擇數字和說明。這裏是相關的代碼:

<input type="text" class="form-control" 
     bs-typeahead 
     bs-options="x.num as (x.num > 0 ? x.num + '. ' + x.Description : '')for x 
        in crc.xList | orderBy: 'x.num'" 
     data-autoSelect="true" 
     data-limit="15" 
     ng-model="crc.newNum" 
     ng-model-options="{ debounce: 500 }" 
     ng-change="crc.getNumInfo(false, true)" /> 

任何幫助將不勝感激 - 謝謝!

回答

0

我認爲這是因爲(x.num > 0 ? x.num + '. ' + x.Description : ''),我認爲角取代空字符串時,x.num是0的值,你可以嘗試做(x.num > 0 ? x.num + '. ' + x.Description : 'test')而不是看看它是否修復它?

+0

我試過你的建議,但那不是 - 仍然看到問題。 –