求一个angularjs公共摸态框的解决方案

白衣如花 2016-12-15 10:16:18
实现类似windows提示框的效果

确认要执行以下操作吗? 确认/取消

html能通过templateUrl,但是controller怎么找到这个公共的呢?
...全文
113 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
白衣如花 2016-12-15
  • 打赏
  • 举报
回复
调用摸态框的代码大致如下:
            var confirm = $modal.open({
                templateUrl: "modal/confirmModal.html",
                controller: "confirmCtrl", // 怎么调用到?
                resolve: {
                    data: function () {
                        return {
                            type: "confirm",
                            msg: "确认进行此次操作吗?"
                        };
                    }
                }
            })
白衣如花 2016-12-15
  • 打赏
  • 举报
回复
摸态框的controller大致如下:
(function () {
    "use strict";
    app.controller("confirmCtrl", function ($scope, data) {
        $scope.message = data.msg;
        if (data.type === "confirm") {
            $scope.headStyle = {
                "background-color": "red",
                "color": "white"
            };
            $scope.title = "警告";
        } else if (data.type === "info") {
            $scope.headStyle = {
                "background-color": "blue",
                "color": "white"
            };
            $scope.title = "提示";
        }
    });
})();

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧