未调用配置模块

config module not called

我使用 ui-routerui-router 找不到我的状态之一:Could not resolve 'main.tabs' from state 'main'。发现没有调用tabs模块的config,所以main.tabs没有注册

初始状态:$urlRouterProvider.otherwise('/main/dashboard');

main.tabs 的导航是通过 <a ui-sref="main.tabs" class="item" ng-click="toggleMenu()">Tabs</a>

完成的

index.html

<script src="app/main/main.js"></script>
<script src="app/tabs/tabs.js"></script>
<script src="app/dashboard/dashboard.js"></script>
<script src="app/app.js"></script>

main.js

var main = angular.module('main', []);

main.config(function ($stateProvider) {
    $stateProvider
        .state('main', {
            url: "/main",
            abstract: true,
            templateUrl: "./app/main/main.html"
        });
});

tabs.js

var tabs = angular.module('tabs', ['main']);

tabs.config(function ($stateProvider) {
    $stateProvider
        .state('main.tabs', {
            url: '/tabs',
            views: {
                'main': {
                    templateUrl: './app/tabs/tabs.html',
                    controller: 'TabsCtrl'
                }
            }
        });
    // This is not called, I don't see the trace in the logs
    console.log($stateProvider);
});

dashboard.js

var dashboard = angular.module('dashboard', ['models.dashboards', 'main']);

dashboard.config(function ($stateProvider) {
    $stateProvider
        .state('main.dashboard', {
            url: "/dashboard",
            views: {
                'main': {
                    resolve: {
                        'dashboard': ['DashboardService', function (DashboardService) {
                            return DashboardService.getInstance();
                        }]
                    },
                    templateUrl: "./app/dashboard/dashboard.html",
                    controller: 'DashboardCtrl'
                }
            }
        });
    console.log($stateProvider);
});

编辑:包含ui.router

app.js(ionic 与 ui-路由器捆绑在一起)

angular.module('starter', ['ionic', 'restangular', 'dashboard', 'ngCordova', 'LocalStorageModule', 'services.auth'])

来自离子源:

var IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router']),

ng-app 来自 index.html

的指令
<body ng-app="starter">
<ion-nav-view></ion-nav-view>
</body>

您的应用是 starter 模块。 starter 取决于 dashboarddashboard 取决于 main。 None 个模块依赖于 tabs。所以 tabs 模块没有加载。