【问题标题】:AngularJS Modal (ui.bootstrap.modal) is not workingAngularJS 模态(ui.bootstrap.modal)不工作
【发布时间】:2015-11-19 21:54:58
【问题描述】:

我只想在我的项目中实现一个 AngularJS 模态 (ui.bootstrap.modal)。每当我单击页面中的按钮时,都需要弹出一个新的弹出窗口(大模式)。我已经使用了引导代码。但不要它似乎没有工作。请帮助我。提前致谢 我的 JS:

$scope.checkBinning = function(){
            selected_checks = $scope.checkGridOptions['selectedItems'];
                $scope.no_show = false;
                $scope.final_select=false;
                $("#checkRecommendTarget").modal('show');
                $scope.route = 'for_escalate';
                $scope.select_title = 'GROUPS';
                $scope.heading = 'Check Binning';

        };

和我的 html 部分:

<button type="button" class="btn btn-danger" ng-click="checkBinning()"> Check Binning </button>

【问题讨论】:

  • 提供足够的代码来复制它。我们不知道你做了什么。使用文档中的 plunker 演示来测试您的代码并不难
  • 这不是ui.bootstrap 代码,而是常规bootstrap.js 代码。您不将 2 一起使用,并且可能会在组合它们时遇到问题。建议您阅读文档

标签: html css angularjs django twitter-bootstrap


【解决方案1】:

您正在代码中使用 jquery bootstrap js 功能 尝试以下:

<button class="btn btn-primary" type="button" ng-click="checkBinning()">Check Binning</button>

    $scope.checkBinning = function () {
    selected_checks = $scope.checkGridOptions['selectedItems'];
    $scope.no_show = false;
    $scope.final_select = false;
    var modalInstance = $modal.open({
        animation: $scope.animationsEnabled,
        templateUrl: 'checkRecommendTarget.html',

        }
    });
    $scope.route = 'for_escalate';
    $scope.select_title = 'GROUPS';
    $scope.heading = 'Check Binning';

};

并像在脚本中一样添加您的模态模板

<script type="text/ng-template" id="checkRecommendTarget.html">

    </script>

别忘了在你的控制器中添加$modal 依赖

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-07
    • 1970-01-01
    • 2018-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多