$Md dialog when loading the page

Asked

Viewed 51 times

-2

I need to open the $Md modal dialog when loading page, any suggestions?

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

2 answers

1


You can use the $timeout:

$timeout($scope.showAdvanced, 0);

Don’t forget to inject the dependency $timeout to make it work properly.

  • @Samuelsouza

0

I got it here too that way:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.