angular-bootstrap模态动画错误

angular-bootstrap modal animation error

我使用 angular-ui bootstrap 为用户输入呈现模态 window。下面是一些相关代码

app_list_create_modal.html

<div>
  <div class="model-header">
    <h3 class="model-title">model's title</h3>
  </div>
  <div class="model-body">

    <div class="my-form-group">
      <select ng-model="app.store" ng-options="option.value as option.display for option in storeOptions" class="my-form-control"></select>
    </div>

    <div class="my-form-group">
      <label for="create_store_id">App ID: </label>
      <input ng-model="app.storeId" id="create_store_id" placeholder="Enter app id" class="my-form-control">
    </div>

  </div>

  <div class="model-footer">
    <button class="my-button" type="button" ng-click="ok()">OK</button>
    <button class="my-button" type="button" ng-click="cancel()">Cancel</button>
  </div>
</div>

custom_directive.js

var app = angular.module('custom_directive', [
    'custom_service'
    ,'summernote'
    ,'ngSanitize'
    ,'ngAnimate'
    ,'ui.bootstrap'
]);

app_list_tag.js(angular 自定义指令)

var app = angular.module('custom_directive')

app.directive('appListTag', [function() {

//... following part inside controller of directive

$scope.open = function() {

    var modalInstance = $modal.open({animation: true, templateUrl: '/public/article/directive/app_list_create_modal.html',
        controller: ['$scope', '$modalInstance', function($scope, $modalInstance) {
            $scope.app = {}
            $scope.storeOptions = constant.selectOptions.storeTypes

            $scope.$watch('app', function(newValue, oldValue) {
                if (newValue) {
                    newValue.store = newValue.store || $scope.storeOptions[0].value
                }
            }, true)

            $scope.ok = function() {
                $modalInstance.close($scope.app)
            }
            $scope.cancel = function() {
                $modalInstance.dismiss()
            }
        }]
    })

    //Modal callback to create app
    modalInstance.result.then(function(app) {
        for (var i = 0; i < $scope.entities.length; i++) {
            if (angular.equals($scope.entities[i], app)) {
                //Note: prevent the same id, ui-select requirement
                helper.emitMessage($scope, helper.dataAppendedWithMessage({}, 'error', 'this app already exist'))
                return
            }
        }
        $scope.entities.push(app)
    })

}

还有一个调用 open() 以呈现模态的按钮

<button type="button" class="btn btn-default" ng-click="open()">Add App</button>

我得到了以下 window

这里有2个问题

  1. 模态边缘 window 看起来不太好

  2. 没有用于显示和隐藏 window

  3. 的动画

边缘问题是因为cssclass错别字model(应该是modal

动画由于angular-animate版本,运行bower update解决。