$ md dialog when loading page

-2

I need to open modal $ md dialog when I load page, any suggestions?

$scope.showAdvanced = function(ev) {
    $mdDialog.show({
      controller: DialogController,
      templateUrl: 'dialog1.tmpl.html',
      parent: angular.element(document.body),
      targetEvent: ev,
    })
};
    
asked by anonymous 21.11.2016 / 12:08

2 answers

1

You can use $timeout :

$timeout($scope.showAdvanced, 0);

Do not forget to inject the dependency of $timeout to work correctly.

    
21.11.2016 / 12:11
0

I was able to do it here as well:

 $mdDialog.show({
    controller: DialogController,
    templateUrl: 'modalDialog.html',  
    scope: $scope,
  });
    
21.11.2016 / 12:21