Error - $dialogs.confirm

Asked

Viewed 37 times

0

I have a problem to use the $dialog angular, before it was working normally, and then started appearing the error below:

angular.min.js:118 TypeError: $dialogs.confirm is not a function
at m.$scope.deleteCapacity (capacityCtrl.js:77)

Controller:

  $scope.deleteCapacity = function(capacity) {
    var dlg = $dialogs.confirm("Confirma a exclusão?", "Você deseja excluir a capacitação " + capacity.nameCapacity + " ?");
    dlg.result.then(function(btn) {
        capacityService.removeCapacity(capacity.idCapacity, function(data) {
            $scope.capacities = capacityService.getCapacity();
        });
    }, function(btn) {
    });
    $scope.capacities = capacityService.getCapacity();
};

Index:

<script type="text/javascript" src="js/libs/angular.min.js"></script>
<script type="text/javascript" src="js/libs/angular-ui-router.min.js"></script>
<script type="text/javascript" src="js/libs/angular-resource.min.js"></script>
<script type="text/javascript" src="js/libs/angular-sanitize.js"></script>
<script type="text/javascript" src="js/libs/ui-bootstrap-custom.js"></script>
<script type="text/javascript" src="js/libs/jquery.js"></script>
<script type="text/javascript" src="js/libs/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/libs/dialogs.js"></script>
<script type="text/javascript" src="js/services/capacityService.js"></script>
<script type="text/javascript" src="js/controllers/capacityCtrl.js"></script>
<script type="text/javascript" src="js/config/routers.js"></script>
<script type="text/javascript" src="js/config/app.js"></script>
  • I know the dialogs removed the $ because it is reserved of the Angularjs, try to remove the $.

  • I took it but it’s still making a mistake...

  • TypeError: dialogs.confirm is not a function&#xA; at b.$scope.deleteCapacity (capacityCtrl.js:77)

  • .controller('capacityController', ['$scope', '$state', '$dialogs', '$location', 'capacityService', '$timeout', function($scope, $state, $dialogs, $location, capacityService, $timeout) The error was due to the order of the directives...

No answers

Browser other questions tagged

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