我的模态给出错误错误:[$ rootScope:inprog] $ digest已在进行中

时间:2016-08-02 00:51:28

标签: angularjs

我正在尝试了解导致此错误的原因

控制器代码

 $scope.newManager = function (isValid) {
        // making a manager
        $http.post('/manager-create', {
            name: $scope.name,
            cellPhone: $scope.phone,
            group: $scope.group.value,
            manager: true
        }).then(function successCallback(response) {
            // this callback will be called asynchronously
            // when the response is available

            // reset the form fields
            $scope.name = '';
            $scope.phone = '';
            var modalInstance = $modal.open({
                templateUrl: 'okay.html',
                controller: 'OkayModal',
            });


        }, function errorCallback(response) {
            // this callback will be called asynchronously
            // when the response is available
            console.log(response); //error
        });

    };

这里是模态本身

angular.module('management').controller('OkayModal', function ($scope, $modalInstance) {

    $scope.okay = function () {
        $modalInstance.dismiss('okay');
    };
});

每当我创建一个新经理时,都会弹出一个模态。但由于某种原因,我收到了这个错误!

0 个答案:

没有答案