[英]angular-bootstrap modal animation error
I use angular-ui bootstrap to present a modal window for user input. 我使用angular-ui引导程序来呈现用于用户输入的模式窗口。 Here are some related code 这是一些相关的代码
app_list_create_modal.html 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 custom_directive.js
var app = angular.module('custom_directive', [
'custom_service'
,'summernote'
,'ngSanitize'
,'ngAnimate'
,'ui.bootstrap'
]);
app_list_tag.js (angular custom directive) app_list_tag.js(角度自定义指令)
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)
})
}
And a button to call open()
to present modal 还有一个按钮,调用open()
来显示模式
<button type="button" class="btn btn-default" ng-click="open()">Add App</button>
I got the following window 我有以下窗口
There are 2 problems here 这里有两个问题
edge of the modal window does not look good 模态窗口的边缘看起来不太好
no animation for showing and hiding the window 没有用于显示和隐藏窗口的动画
The edge problem is because the css class typo model
(should be modal
) 边缘问题是因为CSS类错字model
(应该是modal
)
The animation is due to angular-animate version, running bower update
solves it. 动画归因于角动画版本,运行bower update
可以解决该问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.