2016-03-15 66 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中选择匹配标记 –