我正在尝试在单击按钮时在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";
},
});
}
答案 0 :(得分:0)
Per docs - https://material.angularjs.org/latest/api/service/$mdDialog
应该是templateUrl,而不是模板。
答案 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";
},
});
}