在角度选择菜单中显示预选项目?
我的应用程序中有一个selectize-ng输入:
我的控制器是
$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
的用户selected:true
在该字段中为selected:true
,例如Carole Gardner(在现场手动输入):
这是怎么做到的?