在角度选择菜单中显示预选项目?

时间:2015-03-27 20:12:57

标签: javascript jquery angularjs selectize.js

我的应用程序中有一个selectize-ng输入:

<input type="text" selectize="usersSelect.options" options="users" ng-model="users.selected" />

我的控制器是

    $scope.users = [];

UsersWithRolesFactory.getUserRoleData().then(function(response) {
  $scope.users = response;
});

$scope.usersSelect = {
  options: {
    valueField: 'full_name',
    labelField: 'full_name',
    searchField: ['full_name'],
    plugins: ['remove_button']
  }
};

我的(部分)json数据是

[{"id":17,"full_name":"Janet Willis","selected":false,"merchant":"Geba","role":"Reviewer"},
{"id":18,"full_name":"Michelle Murphy","selected":false,"merchant":"Zazio","role":"Reviewer"},
{"id":19,"full_name":"Carol Gardner","selected":true,"merchant":"Skinte","role":"User"},
{"id":20,"full_name":"Laura Wallace","selected":false,"merchant":"Yacero","role":"User"}]

我需要做的是在现场显示selected:true的用户,例如Carole Gardner(在现场手工输入):

enter image description here

这是怎么做到的?

0 个答案:

没有答案