angular中 modal模态框(可复用)

可复用的 (普通的在function中找) : 点击事件之后的函数
$rootScope.confirm = function(content, okFn, cancelFn) {
    var modal = $modal({
        html: true,
        show: false,
        templateUrl: 'views/template/ptteng-confirm-0.0.1.html',
        controller: function($scope) {
            $scope.content = content;
            $scope.ok = function() {
                typeof okFn == 'function' && okFn();
                modal.$promise.then(modal.hide);
            };
            $scope.cancel = function($scope) {
                typeof cancelFn == 'function' && cancelFn();
                modal.$promise.then(modal.hide);
            };
        }
    });
    modal.$promise.then(modal.show);
};
html:

    
    
ngjs:
vm.delete = function(id) {

    $rootScope.confirm("您确定要删除吗?", function() {
        moduleService.deleteModule(id).then(function(res) {

            $state.go($state.current, {}, {reload: true});

        });
    });

};
模态框html
class="modal ng-scope top am-fade" tabindex="-1" role="dialog" aria-hidden="true" style="display: block;">
class="modal-dialog">
class="modal-content">
class="modal-header">

class="modal-title">提示

class="modal-body"> {{content}}
class="modal-footer">




你可能感兴趣的:(前端)