多模块角度应用程序的结构

时间:2016-03-21 21:59:15

标签: angularjs module

我们需要开发一个必须根据URL Params引导不同模块的应用程序。像APP1一样,如果url有http:domain.com?appName = APP1,APP2如果url有http:domain.com?appName = APP2,但domain.com是相同的。我们如何实现这个以及什么是最好的文件夹结构。

背景

我们正在使用Angular JS,Node(API)

1 个答案:

答案 0 :(得分:0)

绝对https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#modularity - core/**/*.js // all common parts - app1/.. - - ...... - app2 - - app.js // module efinition - - config.js // defined routes/states (ui-router) - - other_module/ - - - app.js // other_module definition - - - config.js // defined routes/states (ui-router) for other_module - - - controllers/*.js || *.spec.js // file with spec.js are for tests - - - directives/*.js - - - services/*.js - - - partials/*.html // for templates - - other_module2/...

使用require.js绑定它,编写测试(例如foo-ctrl.js并使用spec.js扩展名foo-ctrl.spec.js测试此保留在同一目录中)