Md对话框调用模板

时间:2016-10-23 23:01:58

标签: javascript angularjs angular-material

我正在尝试在单击按钮时在md-dialog中加载模板,所有我看到/src/app/pages/signup/signup.html

Home.Controller

 var vm = this;
     vm.showCustomGreeting=function($event){
           var parentEl = angular.element(document.body);
           $mdDialog.show({
             parent: parentEl,
             targetEvent: $event,
             template:require('../signup/signup.html'),
             fullscreen:true,
             controller: function ControllerName($scope){
                        $scope.data = "Controller Loaded";
             },
          });
       }

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

应该是这样的,现在也不需要require函数,只要确保给定的模板路径应该是正确的。试试这个:

var vm = this;
 vm.showCustomGreeting=function($event){
       var parentEl = angular.element(document.body);
       $mdDialog.show({
         parent: parentEl,
         targetEvent: $event,
         templateUrl:'../signup/signup.html',
         parent: angular.element(document.body),
         fullscreen:true,
         controller: function ControllerName($scope){
                    $scope.data = "Controller Loaded";
         },
      });
   }