Angularjs select multiple options from object

前端 未结 4 1667
野趣味
野趣味 2020-12-11 02:34

Trying to select multiple options in angularjs regarding to object values

Here is a code:

myapp.controller(\'myctrl\', [
        \'$scope\',
                 


        
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-11 02:49

    Using a model for statuses ($scope.statuses), and ng-options to iterate over them:

    function MyCtrl($scope) {
        $scope.statuses = [ 'Draft', 'Pending', 'Live', 'Archived', 'Deleted' ];
        $scope.selectedStatuses = [ 'Pending', 'Live' ];
    }​
    

    .

    
    

提交回复
热议问题