在angularjs模糊管理中创建新页面

时间:2022-10-29 19:40:22

According to the tutorial I've added new page and module, but it doesn't seem to work (neither it's shown in a sidebar, nor I can get it via direct url). What am I missing?

根据教程,我添加了新的页面和模块,但是它似乎不能工作(它也没有显示在侧边栏中,我也不能通过直接url获得)。我缺少什么?

2 个解决方案

#1


2  

Note the newPage that you have added has module name as BlurAdmin.pages.myNewPage and state as myNewPage as given in the code

注意,您添加的新页面的模块名为BlurAdmin.pages。myNewPage和state作为myNewPage在代码中给出。

(function () {
    'use strict';

    angular.module('BlurAdmin.pages.myNewPage', [])
    .config(routeConfig);
    /** @ngInject */
    function routeConfig($stateProvider) {
    $stateProvider
        .state('myNewPage', {
            url: '/myNewPage',
            templateUrl: 'app/pages/myNewPage/my-new-page.html',
            title: 'My New Page',
            sidebarMeta: {
                order: 800,
            },
        });
    }

})();

Now goto src/app/pages you will find pages.module.js. You should add mentioned new module to list:

现在去到src/app/页面你会找到page .module.js。您应该添加提到的新模块列表:

angular.module('BlurAdmin.pages', [
    'ui.router',
    'BlurAdmin.pages.dashboard',
    'BlurAdmin.pages.ui',
    'BlurAdmin.pages.components',
    'BlurAdmin.pages.form',
    'BlurAdmin.pages.tables',
    'BlurAdmin.pages.charts',
    'BlurAdmin.pages.maps',
    'BlurAdmin.pages.profile',
    'BlurAdmin.pages.myNewPage'
])

And you are done.

和你做。

#2


0  

after adding the module name to pages.module.js re run gulp serve:dist

将模块名添加到page .module之后。再来一次大口的发球:区

#1


2  

Note the newPage that you have added has module name as BlurAdmin.pages.myNewPage and state as myNewPage as given in the code

注意,您添加的新页面的模块名为BlurAdmin.pages。myNewPage和state作为myNewPage在代码中给出。

(function () {
    'use strict';

    angular.module('BlurAdmin.pages.myNewPage', [])
    .config(routeConfig);
    /** @ngInject */
    function routeConfig($stateProvider) {
    $stateProvider
        .state('myNewPage', {
            url: '/myNewPage',
            templateUrl: 'app/pages/myNewPage/my-new-page.html',
            title: 'My New Page',
            sidebarMeta: {
                order: 800,
            },
        });
    }

})();

Now goto src/app/pages you will find pages.module.js. You should add mentioned new module to list:

现在去到src/app/页面你会找到page .module.js。您应该添加提到的新模块列表:

angular.module('BlurAdmin.pages', [
    'ui.router',
    'BlurAdmin.pages.dashboard',
    'BlurAdmin.pages.ui',
    'BlurAdmin.pages.components',
    'BlurAdmin.pages.form',
    'BlurAdmin.pages.tables',
    'BlurAdmin.pages.charts',
    'BlurAdmin.pages.maps',
    'BlurAdmin.pages.profile',
    'BlurAdmin.pages.myNewPage'
])

And you are done.

和你做。

#2


0  

after adding the module name to pages.module.js re run gulp serve:dist

将模块名添加到page .module之后。再来一次大口的发球:区