ng-options不是从javascript数组中提取的

时间:2018-05-24 23:12:29

标签: javascript angularjs bootstrap-4

<div class="form-group">
            <label for="department" class="col-sm-3 control-label">Department</label>
            <div class="col-sm-9">
                <select name="department" id="department" class="form-control"
                              ng-model="employee.department"
                        ng-options="dept for dept in departments"></select>
            </div>
        </div>
    </fieldset>
    <br />
angularFormsApp.controller('efController',
function efController($scope, efService) {

    $scope.employee = efService.employee;

    $scope.departments = [
        "Engineering",
        "Marketing",
        "Finance",
        "Administration"
    ];

});

0 个答案:

没有答案