其中一个部分html没有在ui-view中加载

时间:2018-06-13 14:51:11

标签: angularjs angular-ui-router

以前我用的是ng-route(工作正常),但现在我需要ui-routing。由于我对AngularJs并不熟悉,而对ui-router一点也不熟悉,我只是做了一个简单的配置: -

    myApp.config(function($stateProvider, $urlRouterProvider) {
        $urlRouterProvider.otherwise("/award_config");
        $stateProvider.state("landing", {
            templateUrl : "screens/landing/landingTemplate.html",
            url: "/landing",
            controller : "landingController"
        }).state("csr_view_sub", {
            templateUrl : "screens/csr/home/csr_viewSubscriberTemplate.html",
            url: "/csr_view",
            controller : "csrController"
        }).state("pm_view_report", {
            templateUrl : "screens/manager/reports/pm_viewReportsTemplate.html",
            url: "/view_report",
            controller : "pm_viewReportsController"
        }).state("award_config", {
            templateUrl : "screens/manager/award_config/award_ConfigTemplate.html",
            url: "/award_config",
            controller : "awardConfigController"
        }).state("create_user", {
            templateUrl : "screens/manager/user/createUser.html",
            url: "/create_user",
            controller : "createUserController",
        }).state("groups", {
            templateUrl : "screens/manager/groups/group.html",
            url: "/groups",
            controller : "groupController"
        });
    });

令人惊讶的是,除了/create_user之外,所有其他部分都正常加载。 如果每次重新加载transition superseeded时,我都会遇到transition aborted /create_user和2个错误。在升级ui-router版本之后我没有得到它,但从功能上来说,/create_user的ui-view仍然是空白的。

错误: -

    angular.js:14800 Error: transition superseded
        at $StateProvider.$get (angular-ui-router.js:2866)
        at Object.invoke (angular.js:5106)
        at angular.js:4893
        at getService (angular.js:5047)
        at injectionArgs (angular.js:5072)
        at Object.invoke (angular.js:5098)
        at angular.js:8267
        at forEach (angular.js:408)
        at Object.<anonymous> (angular.js:8265)
        at Object.invoke (angular.js:5106) "Possibly unhandled rejection: {}"
    (anonymous) @ angular.js:14800
    (anonymous) @ angular.js:11218
    processChecks @ angular.js:17199
    $digest @ angular.js:18352
    $apply @ angular.js:18649
    bootstrapApply @ angular.js:1958
    invoke @ angular.js:5106
    doBootstrap @ angular.js:1956
    bootstrap @ angular.js:1976
    angularInit @ angular.js:1861
    (anonymous) @ angular.js:34354
    fire @ jquery-1.12.4.js:3232
    fireWith @ jquery-1.12.4.js:3362
    ready @ jquery-1.12.4.js:3582
    completed @ jquery-1.12.4.js:3617
    angular.js:14800 Error: transition prevented
        at $StateProvider.$get (angular-ui-router.js:2867)
        at Object.invoke (angular.js:5106)
        at angular.js:4893
        at getService (angular.js:5047)
        at injectionArgs (angular.js:5072)
        at Object.invoke (angular.js:5098)
        at angular.js:8267
        at forEach (angular.js:408)
        at Object.<anonymous> (angular.js:8265)
        at Object.invoke (angular.js:5106) "Possibly unhandled rejection: {}"
    (anonymous) @ angular.js:14800
    (anonymous) @ angular.js:11218
    processChecks @ angular.js:17199
    $digest @ angular.js:18352
    $apply @ angular.js:18649
    bootstrapApply @ angular.js:1958
    invoke @ angular.js:5106
    doBootstrap @ angular.js:1956
    bootstrap @ angular.js:1976
    angularInit @ angular.js:1861
    (anonymous) @ angular.js:34354
    fire @ jquery-1.12.4.js:3232
    fireWith @ jquery-1.12.4.js:3362
    ready @ jquery-1.12.4.js:3582
    completed @ jquery-1.12.4.js:3617
    angular.js:14800 Error: transition aborted
        at $StateProvider.$get (angular-ui-router.js:2868)
        at Object.invoke (angular.js:5106)
        at angular.js:4893
        at getService (angular.js:5047)
        at injectionArgs (angular.js:5072)
        at Object.invoke (angular.js:5098)
        at angular.js:8267
        at forEach (angular.js:408)
        at Object.<anonymous> (angular.js:8265)
        at Object.invoke (angular.js:5106) "Possibly unhandled rejection: {}"
    (anonymous) @ angular.js:14800
    (anonymous) @ angular.js:11218
    processChecks @ angular.js:17199
    $digest @ angular.js:18352
    $apply @ angular.js:18649
    bootstrapApply @ angular.js:1958
    invoke @ angular.js:5106
    doBootstrap @ angular.js:1956
    bootstrap @ angular.js:1976
    angularInit @ angular.js:1861
    (anonymous) @ angular.js:34354
    fire @ jquery-1.12.4.js:3232
    fireWith @ jquery-1.12.4.js:3362
    ready @ jquery-1.12.4.js:3582
    completed @ jquery-1.12.4.js:3617
    angular.js:14800 Error: transition failed
        at $StateProvider.$get (angular-ui-router.js:2869)
        at Object.invoke (angular.js:5106)
        at angular.js:4893
        at getService (angular.js:5047)
        at injectionArgs (angular.js:5072)
        at Object.invoke (angular.js:5098)
        at angular.js:8267
        at forEach (angular.js:408)
        at Object.<anonymous> (angular.js:8265)
        at Object.invoke (angular.js:5106) "Possibly unhandled rejection: {}"
    (anonymous) @ angular.js:14800
    (anonymous) @ angular.js:11218
    processChecks @ angular.js:17199
    $digest @ angular.js:18352
    $apply @ angular.js:18649
    bootstrapApply @ angular.js:1958
    invoke @ angular.js:5106
    doBootstrap @ angular.js:1956
    bootstrap @ angular.js:1976
    angularInit @ angular.js:1861
    (anonymous) @ angular.js:34354
    fire @ jquery-1.12.4.js:3232
    fireWith @ jquery-1.12.4.js:3362
    ready @ jquery-1.12.4.js:3582
    completed @ jquery-1.12.4.js:3617

0 个答案:

没有答案