I have an Angular app and am using Angular-Material among other components. Is it possible to open an Angular Tab Dialog with a TemplateUrl being lazy loaded which contains an Angular form? How would you reference this form if at all possible? Here is some code I use to open the dialog:
$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.';
});
};
Any Help would be appreciated, thank you
We can pass data to the dialog component by using the data property of the dialog configuration object. As we can see, the whole data object initially passed as part of the dialog configuration object can now be directly injected into the constructor.
MatDialog creates modal dialogs that implements the ARIA role="dialog" pattern by default. You can change the dialog's role to alertdialog via MatDialogConfig . You should provide an accessible label to this root dialog element by setting the ariaLabel or ariaLabelledBy properties of MatDialogConfig .
You can pass any kind of data to the component by adding data to the MatDialog's open() options. }, }); You can retrieve the data by injecting MAT_DIALOG_DATA in the opened component.
How To Prevent MatDialog From Closing When Clicked Outside. By default, you could close a material dialog box by clicking outside dialog box element or by pressing the esape key. Angular Material comes with a built-in property called disableClose the prevents this behavior.
Not sure I understand your question correctly but for basic use, pass in your context to locals
and return your info to $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);
See this Code Pen:
http://codepen.io/anon/pen/BjqzJR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With