Angular 带有 Angular 表单的对话框
Angular Dialog with Angular Form
我有一个 Angular 应用程序,正在使用 Angular-Material 等组件。
是否可以打开一个 Angular 选项卡对话框,其中包含一个 Angular 表单的 TemplateUrl 被延迟加载?
如果可能的话,您将如何引用此表格?
这是我用来打开对话框的一些代码:
$scope.showTabDialog = function(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'pages/properties/tabDialog.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
clickOutsideToClose:true
})
.then(function(answer) {
$scope.status = 'You said the information was "' + answer + '".';
}, function() {
$scope.status = 'You cancelled the dialog.';
});
};
任何帮助将不胜感激,谢谢
不确定我是否正确理解了您的问题,但对于基本用途,请将您的上下文传递给 locals
并将您的信息 return 传递给 $mdDialog.hide
$mdDialog.show({
targetEvent: $event,
template: dialogContent,
controller: 'DialogController',
locals: { info: $scope.info }
}).then(function(info) {
if(info) {
$scope.info.userName = info.userName;
}
});
...
$mdDialog.hide(info);
看这支代码笔:
我有一个 Angular 应用程序,正在使用 Angular-Material 等组件。 是否可以打开一个 Angular 选项卡对话框,其中包含一个 Angular 表单的 TemplateUrl 被延迟加载? 如果可能的话,您将如何引用此表格? 这是我用来打开对话框的一些代码:
$scope.showTabDialog = function(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'pages/properties/tabDialog.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
clickOutsideToClose:true
})
.then(function(answer) {
$scope.status = 'You said the information was "' + answer + '".';
}, function() {
$scope.status = 'You cancelled the dialog.';
});
};
任何帮助将不胜感激,谢谢
不确定我是否正确理解了您的问题,但对于基本用途,请将您的上下文传递给 locals
并将您的信息 return 传递给 $mdDialog.hide
$mdDialog.show({
targetEvent: $event,
template: dialogContent,
controller: 'DialogController',
locals: { info: $scope.info }
}).then(function(info) {
if(info) {
$scope.info.userName = info.userName;
}
});
...
$mdDialog.hide(info);
看这支代码笔: