Initialize a modal in ui-router resolve step

I want to show a modal when some conditions are true. But sometimes the modal is not initialized, I need to initialize modal in UI-router resolve step. This depends on $scope

app.controller('HomeController', function($scope, $ionicModal, $ionicLoading) {
  $ionicModal.fromTemplateUrl('templates/modal.html', {
    scope: $scope,
    animation: 'slide-in-up'
  }).then(function(modal) {
    $scope.modal = modal;

  getSomeThingsFromServer(function( data ){
      // show modal, but sometimes it not initialized

I initialize my modals in the controller and it works everytime.

How do you show your modal?