where should I add module dependencies in mean.js (for ng-sortable)

不羁的心 提交于 2019-12-04 06:08:47

When I add a new Angular module to a mean.js based application, I add the module to the config.js file within the public directory. There is a list of module dependencies which you can add to as you add more modules to your project:

Link to source:
https://github.com/meanjs/mean/blob/f4b62ca8199227c6791d535bbf67bba5d2db91f0/public/config.js#L7

Example:

var applicationModuleVendorDependencies = ['ngResource', 'ngAnimate', 'ui.router', 'ui.bootstrap', 'ui.utils'];

Try adding it there instead of using the var listers_mod = angular.module('listers'); line you have in your controller. You may not need to inject it into your controller at all -- looking at the documentation you could just try accessing it in the HTML code after you've added it to your application's module list.

Base on dylants's answer, found the configuration file path has been changed to this file

modules/core/client/app/config.js

I'm using meanjs-version 0.4.2, adding the new module into applicationModuleVendorDependencies works for me.

You can put dependencies as a second parameter of ApplicationConfiguration.registerModule function.

Example, put timer in your module:

public/modules/your-module/your-module.client.module.js:

ApplicationConfiguration.registerModule('your-moduler', ['timer']);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!