Angular bootsrap ui,在焦点上弹出模态模板中的输入

时间:2015-12-18 00:14:23

标签: angularjs angular-bootstrap

如何使用Angular bootsrap ui插件进行焦点弹出输入,在我的角应用程序中,下面是我的模态视图代码:

<div class="col-lg-12 modal-body">
    <div class="form-group" ng-hide="choice.saved">
          <div class="input-group">
             <input type="text" placeholder="Item Name" class="form-control" ng-model="choice.item_name"/>                             

          </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:1)

您可以使用resolve函数将数据输入到模态弹出窗口

angular.module('ui.bootstrap.demo')
.controller('ModalDemoCtrl', function($scope, $uibModal, $log) {

    $scope.items = ['item1', 'item2', 'item3'];

    $scope.animationsEnabled = true;

    $scope.open = function(size) {

        var modalInstance = $uibModal.open({
            animation: $scope.animationsEnabled,
            templateUrl: 'myModalContent.html',
            controller: 'ModalInstanceCtrl',
            size: size,
            resolve: {
                items: function() {
                    return $scope.items;
                }
            }
        });
    }
})