AngularJS模态弹出下拉列表无法正常工作

时间:2016-07-28 09:52:03

标签: javascript jquery angularjs

<a href="" ng-click="open_pop()">Open Popup</a>

controller.js

$scope.open_pop = function() {
    var modalInstance = $uibModal.open({
                template: '<div id="order-flow-modal" class="inmodal" ng-controller="orderListingCtrl">\n\
                        <div class="modal-header">\n\
                            <button aria-hidden="true" data-dismiss="modal" id="reg_close" class="close reg" type="button"  ng-click="cancel()"><i class="fa fa-times"></i></button>\n\
                            <h4 class="modal-title">Courier Form</h4>\n\
                        </div>\n\
                        <form  class="form-horizontal" ng-submit="shippedForm()">\n\
                            <div class="modal-body">\n\
                                <div class="form-group"><label>Select Courier:</label> <select name="courier_list" class="form-control" id="modal_courier_list" ng-model="shipped.courier_list" ng-init="shipped.courier_list=option.id" ng-options="option.id as option.name for option in list_of_couriers.availableOptions" required="required">\n\
                                    <option class="" value="" selected="selected">Select Courier</option>\n\
                                </select></div>\n\
                            </div>\n\
                            <div class="modal-footer">\n\
                                <button type="submit" class="btn btn-success">Submit</button>\n\
                            </div>\n\
                        </form>\n\
                    </div>',
                windowClass: "animated flipInY",
                controller: ModalInstanceCtrl,
                backdrop: true
            });


    modalInstance.opened.then(function() {
        $timeout(function() {
                $scope.list_of_couriers = {
                    model: null,
                    availableOptions: [
                      {id : 1, color : "DHL"},
                      {model : 2, color : "BLUED"},
                      {model : 3, color : "DELIVERY"}
                    ]
               };
            }
        }, 0);
    });
}

这是我的代码。但list_of_couriers.availableOptions无法在弹出窗口中工作。请帮帮我。

0 个答案:

没有答案