Close modal using its own controller - AngularJS

0

Good afternoon,

Using AngularJS 1.6:

I have a Login.html view that at a certain moment, launches a pop-up called 'modalAuthorization'. This modal has its own controller (independent of loginController).

The modal has 2 buttons, accept and reject, if I click on any of them, it will be called (logically) to the methods of the 'modalAuthorizationController' controller, at the end of the logic of these actions, I want the modality to be closed but not I get it.

If the modal was contained in the Login controller it would be easier (a close () or a $ scope.modal = false) but for a series of reasons I have to do it like that.

In short, I would have to do, as it were, a 'close-myself'

app.controller('authorizationCtrl', ['$scope', 'AppService_Ajax', 'urlsRest', 'gettextCatalog', 'AppService_PersistData', 'AppService_Mensajes', function ($scope, AppService_Ajax, urlsRest, gettextCatalog, AppService_PersistData, AppService_Mensajes) {

  $scope.urlAuthorization = urlsRest.urlRestGeneral + '/addEntityParameter';


  $scope.rejectAuthorization = function () {
    var obj = {
        'idParametro': 25,
        'codValor': '0'
    }

    AppService_Ajax.sync($scope.urlAuthorization, 'POST', obj, function (res) {
        if (res.code == 0) {
            //HERE THE CLOSE METHOD
        }
    }
    );

    $scope.close();
    $state.go('app.administrador');
}
}]);

Thanks!

    
asked by Argon 16.11.2017 в 13:41
source

0 answers