Show modal based on localStorage variable

Edit: I opened a new more detailed topic for this: Automatically open Modal

// Show modal here

that’s actually the part I’m interessed in! :smile:

I can’t seem to get my modal to open from within the controller. Here’s what I’ve got:

app.controller('AppCtrl', function ($scope, User, Modal) {
    
    Modal.fromTemplateUrl('templates/modal.html', function (modal) {
        $scope.modal = modal;
    }, {
        scope: $scope,
        animation: 'slide-in-up'
    });
    
    $scope.openModal = function() {
        $scope.modal.show();
    };
    
    $scope.closeModal = function() {
        $scope.modal.hide();
    };

    $scope.$on('user.notAuthorized', function(e) {
          /**
           * I can't get the modal to open from here. How would I call it?
           * All of the following doesn't work:
           * $scope.openModal();
           * $scope.modal.show();
           * this.openModal();
           */
    });
    
    User.isAuthorized();
});

Any help is highly appreciated!