2016-03-15 41 views
0

這裏是我的代碼:在下降,從數據庫中獲取值下降

<ui-select ng-model="apptDetails.profile" name="profile" theme="bootstrap" ng-required="true"> 
    <ui-select-match placeholder="Select Profile" >{{$select.selected.Profile_name}} 
    </ui-select-match> 
    <ui-select-choices 
     repeat="profile.Profile_id as profile in profileList | filter: $select.search"> 
     <span ng-bind-html="profile.Profile_name | highlight: $select.search" ></span> 
    </ui-select-choices> 
</ui-select> 

我需要從數據庫中獲取價值和它在下拉菜單中顯示出來,我在NG-模型得到的值,但它不能在下降設置下來(不在選項),但是,如果我發送後請求它的作品。

例如:如果配置文件在特定用戶的數據庫上是abc,它將顯示在選定的下拉列表中。當我從表單中獲取該用戶的信息時,所有文本字段都會從模型中獲取數據,但不能在下拉列表中顯示。

+0

你可以讓JS搗鼓它 –

+0

什麼用JS小提琴是什麼意思? –

+0

它是一個在線平臺,您可以在線運行和測試您的js和html代碼 –

回答

1

你可能做錯了......正如我在plunker,其做工精細創造了一個演示。 可能是它可以幫助你......

https://plnkr.co/edit/43ToW4?p=preview

+0

是ngSanitize需要cuz我沒有注入控制器或模塊? –

+0

難道你沒有在角度模塊定義中注入'ui.select'。 –

+0

是的,我注入了那一個。當我調試我從editDetails中的數據庫中獲取profile_id和名稱。但它沒有設置就像你提供了一個鏈接從plnkr –

0

嘗試此NG-重複

<ui-select-choices 
    repeat="profile in profileList | filter:$select.search"> 
    <span ng-bind-html="profile.Profile_name | highlight: $select.search" >  </span> 
    </ui-select-choices> 
+0

不,它也顯示該配置文件的id。但是,我用id來存儲數據庫。 –

+0

你想顯示所有你的在範圍中的詳細信息? –

+0

在UI中選擇匹配標記 –