我的应用程序中有一个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(在现场手工输入):
这是怎么做到的?