将范围注入角度材料模态

时间:2017-01-08 19:15:43

标签: angularjs modal-dialog angular-material

我试图使用角度材质打开一个模态并注入父数据库的范围,我的数据是。

我试图在这里松散地遵循自定义/高级示例: https://material.angularjs.org/latest/demo/dialog

关闭后我不需要对话框做任何事情,所以我已经删除了Dialogcontroller,它似乎只处理'取消'并且回答'在收盘时(如果我在这里错了,请纠正我)

此处的最终目标是在模式中访问调查,模式是父项范围内的对象。

我的父HTML有审核按钮:

const_iterator

触发功能:

<input type="button" value="Review" ng-click="vm.openReview($event)" />

(function () {
    appModule
    // parent controller
    .controller('tenant.views.surveys.index', [
        '$scope', 'abp.services.app.survey', '$filter', '$mdDialog',
        function ($scope, surveyService, $filter, $mdDialog) {
            var vm = this;

            vm.openReview = function (ev) {
                $mdDialog.show({
                    //controller: DialogController,// not needed
                    templateUrl: "/App/tenant/views/surveys/review_modal.html",
                    parent: angular.element(document.body),
                    targetEvent: ev,
                    clickOutsideToClose: true,
                    fullscreen: true
                })
                //.then(function (answer) {// not needed
                //    vm.modalStatus = 'You said the information was "' + answer + '".';
                //}, function () {
                //    vm.modalStatus = 'You cancelled the dialog.';
                //});
            };

            // not needed
            //function DialogController($scope, $mdDialog) {
            //    $scope.hide = function() { $mdDialog.hide(); };
            //    $scope.cancel = function() { $mdDialog.cancel(); };
            //    $scope.answer = function(answer) { $mdDialog.hide(answer);  };
            //}
        }
    ])

现在,在我的模式中,我有一些内容:

   // then the modal controller
    .controller('tenant.views.surveys.review', [
        '$scope', 'abp.services.app.survey',
        function ($scope, surveyService) {
            var vmModal = this;
        }
    ]);

})();

但我认为我错过了一件作品。我不认为vmModal实际上包含父母的范围。我想访问vmModal.survey。

我是否需要/可以将示波器直接注入模态控制器吗?

0 个答案:

没有答案
相关问题