Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS错误:d[h]。应用不是函数_Angularjs - Fatal编程技术网

AngularJS错误:d[h]。应用不是函数

AngularJS错误:d[h]。应用不是函数,angularjs,Angularjs,当我导航离开我的角度站点中的页面时,错误控制台将充满(发生108次)错误: Error: d[h].apply is not a function jf/this.$get</n.prototype.$broadcast@http://localhost:9885/Scripts/angular.min.js:137:355 jf/this.$get</n.prototype.$destroy@http://localhost:9885/Scripts/angular.min.js:

当我导航离开我的角度站点中的页面时,错误控制台将充满(发生108次)错误:

Error: d[h].apply is not a function
jf/this.$get</n.prototype.$broadcast@http://localhost:9885/Scripts/angular.min.js:137:355
jf/this.$get</n.prototype.$destroy@http://localhost:9885/Scripts/angular.min.js:133:254
ye</<.link/<@http://localhost:9885/Scripts/angular.min.js:252:477
jf/this.$get</n.prototype.$digest@http://localhost:9885/Scripts/angular.min.js:132:257
jf/this.$get</n.prototype.$apply@http://localhost:9885/Scripts/angular.min.js:135:267
Kc[c]</<.compile/</<@http://localhost:9885/Scripts/angular.min.js:252:124
n.event.dispatch@http://localhost:9885/Scripts/jquery-bundle.js:3:6414
n.event.add/r.handle@http://localhost:9885/Scripts/jquery-bundle.js:3:3224

发现问题是用于设置历史动画的第三方模块(角度时间轴)

检查您的服务/工厂功能。您是否将它们正确地注入控制器?在注入和调用服务时,您需要正确的顺序。这是猜测,因为如果没有代码,它是无用的,我会将代码添加到我的问题中,因为错误只发生在导航离开此特定页面/控制器时,因此它必须限于我在此代码中犯的错误,特别是问题可能出在您的服务中,请检查它们,或者通过firebug或其他工具对它们进行调试……发现问题在于第三方的历史动画模块
app.controller('ticketController', ['$scope', '$state', 'Page', 'globals', 'localStorageService', 'Ticket', 'User', 'ticketData', 'ELearning', 'dialogs', 'Notification', 'Payment','Note', 'DTOptionsBuilder', 'DTColumnDefBuilder', 'History', 'Correspondance',function ($scope, $state, Page, globals, localStorageService, Ticket, User, ticketData, ELearning, dialogs, Notification, Payment,Note, DTOptionsBuilder, DTColumnDefBuilder, History, Correspondance) {
if (globals.debug) { console.log('Ticket controller loaded'); }

$scope.globals = globals;

Page.setTitle(ticketData.forename + ' ' + ticketData.surname);

$scope.authData = localStorageService.get('authorizationData');
$scope.ticket = ticketData;
$scope.user = User.admindata({ id: ticketData.ticketGUID });
$scope.person = {};
$scope.reOpenTicket = {
    isOpen: false,
    previousChanges: [],
    newCriticalDate: moment(new Date($scope.ticket.criticalDate)).add(1, 'M').format('DD MMM YYYY'),
    minCriticalDate: moment(new Date($scope.ticket.criticalDate)).add(-1, 'd').format('DD MMM YYYY'),
    maxCriticalDate: moment(new Date($scope.ticket.criticalDate)).add(1, 'M').add(1, 'd').format('DD MMM YYYY'),
    minErrorDate: moment(new Date($scope.ticket.criticalDate)).format('DD MMM YYYY'),
    maxErrorDate: moment(new Date($scope.ticket.criticalDate)).add(1, 'M').format('DD MMM YYYY'),
    reason: '',
    form: {},
    saving: false,
    saveError: ''
};

$scope.notes = {
    data: [],
    newNote: '',
    loading: false,
    loadError: ''
};

$scope.payments = {
    data: [],
    loading: true,
    dtOptions: {},
    dtColumnDefs: {},
    ticketGUID: ''
};

$scope.learning = {
    data: [],
    loading: true,
    ticketGUID: '',
    dtOptions: {},
    dtColumnDefs: {}
};

$scope.history = {
    data: [],
    loading: true,
    loadError: ''
};

$scope.letters = {
    data: [],
    loading: true,
    laddaResendLetter: false,
    laddaCancelLetter: false
};

$scope.dob = {
    minDate: moment(new Date()).add(-90, 'y').format(),
    maxDate: moment(new Date()).add(-10, 'y').format()
};

$scope.titles = ['Mr', 'Miss', 'Mrs', 'Ms', 'Dr', 'Rev'];

$scope.savePersonTab = function (validity) {
    if (validity) {
        $scope.ticket.dateOfBirth = $scope.dob.chosenDate;

        Ticket.personTabSave({ 'id': $scope.ticket.ticketGUID }, $scope.ticket, function (success) {
            Notification.success('Record updated successfully');
            Ticket.getAdmin({ id: success.ticketGUID });
            $scope.person.form.$setPristine();
            $scope.getHistory();
        }, function (error) {

        });
    } else {
        console.log('skip Save');
    }
};

//#region Tickets

$scope.reopenTicket = function () {
    $scope.reOpenTicket.isOpen = true;
    $scope.reOpenTicket.previousChanges = Ticket.getCriticalDateChanges({ id: $scope.ticket.ticketGUID });

    // Reset
    $scope.reOpenTicket.saveError = '';
    $scope.reOpenTicket.reason = '';
};

$scope.saveReopen = function (validity) {
    if (validity) {
        $scope.reOpenTicket.saving = true;
        var data = {
            ChangeTo: $scope.reOpenTicket.newCriticalDate,
            ChangeReason: $scope.reOpenTicket.reason
        };
        Ticket.reOpenTicket({ id: $scope.ticket.ticketGUID }, data, function (response) {

            $scope.reOpenTicket.saving = false;

            if (response.isSuccessful) {
                $scope.getNotes();
                $scope.getHistory();
                $scope.ticket = Ticket.getAdmin({ id: $scope.ticket.ticketGUID });

                $scope.reOpenTicket.isOpen = false;

            } else {
                $scope.reOpenTicket.saveError = response.errorMessage;
            }
        });
    }
};

$scope.closeNewCriticalDate = function () {
    $scope.reOpenTicket.isOpen = false;
};

$scope.confirmTCs = function () {

    var opts = {
        'keyboard': true,
        'size': 'lg' //small or large modal size
    };

    // Checks
    if ($scope.person.form.$dirty) {
        dialogs.notify('Cannot Confirm!', 'Unsaved changes to personal details detected.', opts);
        return;
    }

    // email address is complete
    if (!$scope.ticket.eMailAddress) {
        dialogs.notify('Cannot confirm!', 'An Email address must be entered and saved before confirming Terms and Conditions.', opts);
        return;
    } else {
        if ($scope.ticket.status != 'AwaitingPayment' && $scope.ticket.status != 'Referred') {
            dialogs.notify('Cannot confirm!', 'Ticket status must be Awaiting Payment or Referred before confirming Terms and Conditions. The current ticket status is ' + $scope.ticket.status, opts);
            return;
        }
    }

    var dlg = dialogs.confirm('Confirm terms and conditions', 'Please confirm that this delegate has read and agreed to the Terms and Conditions and also the details and offence relate to them.', opts);
    dlg.result.then(function (btn) {
        Ticket.confirmation({ 'id': $scope.ticket.ticketGUID }, $scope.ticket, function (success) {
            Notification.success('Record updated successfully');
            $scope.ticket = success;
            $scope.getHistory();
        }, function (error) {

        });
    });
};

$scope.lockTicket = function () {
    Ticket.lock({ id: $scope.ticket.ticketGUID }, function (success) {
        $scope.ticket = success;
        $scope.getHistory();
        Notification.success('Ticket has been locked');
    }, function (error) {
        console.log(error);
    });
};

$scope.unlockTicket = function () {
    Ticket.unlock({ id: $scope.ticket.ticketGUID }, function (success) {
        $scope.ticket = success;
        $scope.getHistory();
        Notification.success('Ticket has been unlocked');
    }, function (error) {
        console.log(error);
    });
};

$scope.cancelTicket = function () {
    Ticket.cancelTicket({ id: $scope.ticket.ticketGUID }, function (success) {
        $scope.ticket = success;
        $scope.getHistory();
        Notification.success('Ticket has been cancelled');
    }, function (error) {
        console.log(error);
    });
};

$scope.restoreTicket = function () {
    Ticket.restoreTicket({ id: $scope.ticket.ticketGUID }, function (success) {
        $scope.ticket = success;
        $scope.getHistory();
        Notification.success('Ticket has been restored');
    }, function (error) {
        console.log(error);
    });
};


//#endregion

//#region Payments
$scope.markAsPaid = function () {
    var opts = {
        'keyboard': true,
        'size': 'lg' //small or large modal size
    };

    var dlg = dialogs.confirm('Mark as paid', 'Please confirm that you would like to manually mark this delegate as having paid.', opts);
    dlg.result.then(function (btn) {
        Payment.markAsPaid({ 'id': $scope.ticket.ticketGUID }, $scope.ticket, function (success) {
            Notification.success('Record updated successfully');
            $scope.ticket = Ticket.getAdmin({ id: success.ticketGUID });
        }, function (error) {
            console.info(error);
        });
    });
};
$scope.payments.dtOptions = DTOptionsBuilder.newOptions()
    .withPaginationType('full_numbers')
    .withDOM('tr');
$scope.payments.dtColumnDefs = [
    DTColumnDefBuilder.newColumnDef(0),
    DTColumnDefBuilder.newColumnDef(1).withOption('width', '180'),
    DTColumnDefBuilder.newColumnDef(2),
    DTColumnDefBuilder.newColumnDef(3),
    DTColumnDefBuilder.newColumnDef(4)
];

$scope.getPaymentData = function () {
    $scope.payments.loading = true;
    Payment.query({ id: $scope.ticket.ticketGUID }, function (result) {
        $scope.payments.loading = false;
        $scope.payments.data = result;
    });
};
//#endregion

//#region Notes
$scope.addNote = function () {
    Note.add({ id: $scope.ticket.ticketGUID }, '"' + $scope.notes.newNote + '"', function (successResponse) {
        $scope.notes.data.push(successResponse);
        $scope.notes.newNote = '';
        Notification.success('Note added');
    }, function (err) {
        console.log(err);
    });
};
$scope.getNotes = function () {
    $scope.notes.loading = true;
    $scope.notes.data = Note.query({ id: $scope.ticket.ticketGUID }, function (successResponse) {
        $scope.notes.loading = false;
        $scope.notes.loadError = '';
    }, function (error) {
        $scope.notes.loading = false;
        $scope.notes.loadError = error.data;
    });
};
//#endregion

//#region ELearning
$scope.learning.dtOptions = DTOptionsBuilder.newOptions()
    .withPaginationType('full_numbers')
    .withDOM('tr');

$scope.learning.dtColumnDefs = [
DTColumnDefBuilder.newColumnDef(0),
DTColumnDefBuilder.newColumnDef(1),
DTColumnDefBuilder.newColumnDef(2),
DTColumnDefBuilder.newColumnDef(3).notSortable()
];

$scope.getLearningData = function () {
    $scope.learning.loading = true;
    ELearning.query({ id: $scope.ticket.ticketGUID }, function (result) {
        $scope.learning.loading = false;
        $scope.learning.data = result;
    });
};
$scope.markAsCompleted = function () {
    ELearning.MarkAsCompleted({ id: $scope.ticket.ticketGUID }, function (successResponse) {
        $scope.ticket = successResponse;
        $scope.getHistory();
        $scope.getLearningData();
        Notification.success('Ticket has been marked as completed');
    });
};

$scope.getLearningHistory = function (learningData) {
    var dlg = dialogs.create('app/elearning/ResultDialog.html', 'learningDialogController', { data: learningData.onlineLearningResultId }, 'lg');
};

//#endregion

//#region History
$scope.getHistory = function () {
    $scope.history.loading = true;

    History.query({ id: $scope.ticket.ticketGUID }, function (successResponse) {
        $scope.history.data = successResponse;
        $scope.history.loading = false;
        $scope.history.loadError = '';
    }, function (error) {
        $scope.history.loading = false;
        $scope.history.loadError = error.data;
    });
};

$scope.animateElementIn = function ($el) {
    $el.removeClass('hidden');
    $el.addClass('bounce-in');
};

// optional: not mandatory (uses angular-scroll-animate)
$scope.animateElementOut = function ($el) {
    $el.addClass('hidden');
    $el.removeClass('bounce-in');
};
//#endregion

//#region Correspondance
$scope.getCorrespondanceData = function () {
    $scope.letters.loading = true;
    Correspondance.query({ id: $scope.ticket.ticketGUID }, function (result) {
        $scope.letters.loading = false;
        $scope.letters.data = result;
    });
};

$scope.resendLetter = function (letter) {
    $scope.letters.laddaResendLetter = true;

    Correspondance.resend({ id: letter.correspondanceID }, function (result) {
        Notification.success('New ' + result.correspondanceType.toLowerCase() + ' ' + result.deliveryMethod.toLowerCase() + ' has been requested');
        $scope.getCorrespondanceData();

        $scope.letters.laddaResendLetter = false;
    }, function (error) {
        $scope.letters.laddaResendLetter = false;
    });
};

$scope.cancelLetter = function (letter) {
    $scope.letters.laddaCancelLetter = true;

    Correspondance.cancelLetterRequest({ id: letter.correspondanceID }, function (result) {
        Notification.success(result.correspondanceType.toLowerCase() + ' ' + result.deliveryMethod.toLowerCase() + ' has been cancelled');
        $scope.getCorrespondanceData();

        $scope.letters.laddaCancelLetter = false;
    }, function (error) {
        $scope.letters.laddaCancelLetter = false;
    });
};
//#endregion

$scope.getPaymentData();
$scope.getNotes();
$scope.getLearningData();
$scope.getHistory();
$scope.getCorrespondanceData();}]);