Question: I'm using $mdDialog to show popup alerts. I want to refresh the the page whenever I close the Pop up container. 

```
 $scope.updateCustomer = function(){
   HomeService.updateCustomer($scope.update)
    .then (function success(response){ 
        $mdDialog.show(
            $mdDialog.alert()
              .parent(angular.element(document.querySelector('#popupContainer')))
              .clickOutsideToClose(true)
              .textContent("Username has been changed successfully!")
              .ariaLabel('')
              .ok('Ok')
          );
    },
    function error(response){
        $mdDialog.show(
            $mdDialog.alert()
              .parent(angular.element(document.querySelector('#popupContainer')))
              .clickOutsideToClose(true)
              .textContent("Something is wrong!")
              .ariaLabel('')
              .ok('Ok')
          );
  });
} 

```

How to refresh the page when I close the pop up container?

Answer: 
This was the working answer for my problem...

```
 $scope.updateCustomer = function(){
   HomeService.updateCustomer($scope.update)
    .then (function success(response){ 
        $mdDialog.show(
            $mdDialog.alert()
              .parent(angular.element(document.querySelector('#popupContainer')))
              .clickOutsideToClose(true)
              .textContent("Username has been changed successfully!")
              .ariaLabel('')
              .ok('Ok')
              .onRemoving(window.location.reload())
          );

    },
    function error(response){
        $mdDialog.show(
            $mdDialog.alert()
              .parent(angular.element(document.querySelector('#popupContainer')))
              .clickOutsideToClose(true)
              .textContent("Something is wrong!")
              .ariaLabel('')
              .ok('Ok')

          );              
  });
} 

```
Page reloading is not quite the angularjs pattern but you can use:

```
$mdDialog
  .show({
    ...
    onRemoving: function() {
      window.location.reload();
    }
  });

```

Ref.: [$mdDialog Service](https://material.angularjs.org/latest/api/service/$mdDialog#mddialog-show-optionsorpreset)