Angularjs $mdDialog.confirm()和自定义模板URL
我在应用程序中使用$mdDialog,但希望将其用作“确认”对话框,而不是普通对话框。这意味着,在用户单击确认对话框中的两个按钮之一之前,代码流不应继续。我注意到可以使用$mdDialog.confirm(),但我不确定如何将它与自定义templateUrl和相应的控制器一起用作对话框的内容 以下是我所写的内容,就对话框而言,它运行良好,但在打开对话框后代码流不会停止。它应该停止,直到用户单击“确定”或“取消”Angularjs $mdDialog.confirm()和自定义模板URL,angularjs,material-design,angular-material,Angularjs,Material Design,Angular Material,我在应用程序中使用$mdDialog,但希望将其用作“确认”对话框,而不是普通对话框。这意味着,在用户单击确认对话框中的两个按钮之一之前,代码流不应继续。我注意到可以使用$mdDialog.confirm(),但我不确定如何将它与自定义templateUrl和相应的控制器一起用作对话框的内容 以下是我所写的内容,就对话框而言,它运行良好,但在打开对话框后代码流不会停止。它应该停止,直到用户单击“确定”或“取消” $mdDialog.show({ controller: 'incomi
$mdDialog.show({
controller: 'incomingCallDialogController',
templateUrl: 'app/components/others/incomingCallDialog/incomingCallDialog.tpl.html',
locals: {message: message},
parent: angular.element(document.body)
}).then(function (answer) {
console.log("here");
}
基本上是这样的:
var confirm = $mdDialog.confirm({
controller: 'incomingCallDialogController',
templateUrl: 'app/components/others/incomingCallDialog/incomingCallDialog.tpl.html',
locals: {message: message},
parent: angular.element(document.body)
})
$mdDialog.show(confirm).then(function() {
console.log("here");
}
下面是一个使用Matrial Ui和图标/图像的
Screenshot : https://i.stack.imgur.com/rghwX.png
Online demo : https://codepen.io/MuhammadRizwan/pen/aYBKqW?editors=1010
试试这个
$scope.showTimContent = function (tim) {
$mdDialog.show({
controller: ['$scope', '$mdDialog', 'tim', $scope.ViewTimContentCtrl],
templateUrl: 'wgt/tim/TimContentDialog.html',
locals: {'tim': tim},
clickOutsideToClose: true,
});
};
$scope.ViewTimContentCtrl = function ($scope, $mdDialog, tim) {
$scope.tim = tim;
$scope.hide = function () {
$mdDialog.hide();
};
$scope.cancel = function () {
$mdDialog.cancel();
};
};
给我们更多的代码,这个
$mdDialog
的代码是什么,通常您必须在然后
回调函数中执行代码