2016-03-29 49 views
1

我一直在使用下面的命令

$ yo meanjs:crud-module <module-name> 

但它創建的模塊後,我收到以下錯誤,我meanjs應用程序創建新的模塊除了露出雪白的頁面與控制檯錯誤

rror: [$injector:unpr] Unknown provider: MenusProvider <- Menus 
http://errors.angularjs.org/1.5.3/$injector/unpr?p0=MenusProvider%20%3C-%20Menus 
return new ErrorConstructor(message); 

我使用下面發生器的版本沒有運行

-- [email protected] 

任何人都可以告訴我什麼是錯誤。
我的模塊名稱是客戶

回答

0

當向默認模板添加新的CRUD模塊時,菜單的名稱通常是「topbar」而不是「Menus」。試試這個,讓我知道。

3

在client \ config \ customers.cliuent.config.js中,yo包引用menuService作爲Menu。將引用更改爲正確的對象名稱,它將解決問題。

0

我遇到過同樣的問題。您應該在customers.client.config.js中將Menus替換爲menuService。因此,這將是這樣的:

(function() { 
    'use strict'; 

    angular 
    .module('customers') 
    .run(menuConfig); 

    menuConfig.$inject = ['menuService']; 

    function menuConfig(menuService) { 
    // Set top bar menu items 
    menuService.addMenuItem('topbar', { 
     title: 'Customers', 
     state: 'customers', 
     type: 'dropdown', 
     roles: ['*'] 
    }); 

    // Add the dropdown list item 
    menuService.addSubMenuItem('topbar', 'customers', { 
     title: 'List Customers', 
     state: 'customers.list' 
    }); 

    // Add the dropdown create item 
    menuService.addSubMenuItem('topbar', 'customers', { 
     title: 'Create Customer', 
     state: 'customers.create', 
     roles: ['user'] 
    }); 
    } 
}()); 
8
在客戶端

\設置\ customers.cliuent.config.js reemplace這一行:

menuConfig.$inject = ['menuService']; 

與此:

menuConfig.$inject = ['Menus']; 
2

這個普遍的問題是由於以下兩個原因造成: -

1- bower.json尚未正確更新,此用途 - >>

$涼亭更新

2 - 由於大多數的開發者已經提到的驗證,如果源文件夾中(如:SRC) - >>

src/module/(your crud module filename)/client/config/codes.client.config 

變化

值menuConfig。$ inject = ['menuService'];

menuconfig的$注入= [ '菜單']。

試過並測試..所以如果你仍然面臨問題,請分享錯誤信息。

相關問題