Two of my templates are named Left_template_view_html
and center_template_view_html
When I click on a md-button
in the Left_template_view_html
I am attempting to display an mdDialog
on the document.body
What should I pass into the parent parameter: angular.element()
?
The functionality is working correctly for me, but there is a console error.
$scope.showAdvancedSelection = function(ev,templateURL) {
$mdDialog.show({
controller: DialogController,
template: templateURL,
parent: angular.element(document.getElementById(document.body)),
targetEvent: ev,
clickOutsideToClose: true
})
.then(function (answer) {
$scope.status = 'true';
}, function () {
$scope.status = 'You cancelled the dialog.';
});
};
Error:
angular.js:14525 TypeError: Cannot read property 'element' of null
at f (angular-material.min.js:16)
at angular-material.min.js:16
at angular.js:16832
at m.$digest (angular.js:17971)
at m.$apply (angular.js:18269)
at l (angular.js:12387)
at XMLHttpRequest.A.onload (angular.js:12541) "Possibly unhandled rejection: {}"