Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MEANJS样板文件:在哪里包含自定义javascript文件?_Javascript_Angularjs_Meanjs - Fatal编程技术网

MEANJS样板文件:在哪里包含自定义javascript文件?

MEANJS样板文件:在哪里包含自定义javascript文件?,javascript,angularjs,meanjs,Javascript,Angularjs,Meanjs,我开始使用Mean JS样板文件(),并想知道建议将公共自定义javascript、jQuery文件(例如FacebookSDK、jQuery动画等)放在哪里 我假设它会在公共文件夹的某个地方。默认结构如下所示: 它应该放在模块或lib文件夹中吗?你能给每个文件夹的功能提供更多的指导吗?有什么指导原则吗?这是一篇关于Angular应用程序文件夹结构的好文章: 要回答您关于jQuery/bootstrap.js之类的问题,我会将它们放在libs文件夹中 我现在在我所有的应用程序中都使用这种方法。

我开始使用Mean JS样板文件(),并想知道建议将公共自定义javascript、jQuery文件(例如FacebookSDK、jQuery动画等)放在哪里

我假设它会在公共文件夹的某个地方。默认结构如下所示:


它应该放在模块或lib文件夹中吗?你能给每个文件夹的功能提供更多的指导吗?有什么指导原则吗?

这是一篇关于Angular应用程序文件夹结构的好文章:

要回答您关于jQuery/bootstrap.js之类的问题,我会将它们放在libs文件夹中

我现在在我所有的应用程序中都使用这种方法。对于您的Angular文件,小型应用程序的旧方法可能是:

app/
----- controllers/
---------- mainController.js
---------- otherController.js
----- directives/
---------- mainDirective.js
---------- otherDirective.js
----- services/
---------- userService.js
---------- itemService.js
----- js/
---------- bootstrap.js
---------- jquery.js
----- app.js
views/
----- mainView.html
----- otherView.html
----- index.html
更好更有效的方法(也更具描述性):

我在当前项目中使用的内容:

你找到更好的答案了吗?我需要进一步研究。我非常喜欢你的文件夹结构。唯一的问题是MeanJS样板文件的粒度结构要大得多。每个模块(或结构中的组件)都有自己的路由文件、配置文件甚至css/和img/文件夹。我无法理解这个逻辑,但可能值得再问一个问题哦,是的,我尝试过MeanJS和MeanIO,就像我与Yoeman一起下载的其他项目一样,我最终删除了其中的大部分内容,并创建了自己的结构。最终,我可能会发布我自己的Yoeman版本,所以我会下载我喜欢的东西,以我喜欢的方式进行安装,SASS文件和一个有角度的应用程序启动程序:)我发现最好的方法是使用你最终认为最好的。让事情变得轻松…@StephLhm我想知道完全相同的事情,你解决了什么?谢谢
app/
----- shared/   // acts as reusable components or partials of our site
---------- sidebar/
--------------- sidebarDirective.js
--------------- sidebarView.html
---------- article/
--------------- articleDirective.js
--------------- articleView.html
----- components/   // each component is treated as a mini Angular app
---------- home/
--------------- homeController.js
--------------- homeService.js
--------------- homeView.html
---------- blog/
--------------- blogController.js
--------------- blogService.js
--------------- blogView.html
----- app.module.js
----- app.routes.js
assets/
----- img/      // Images and icons for your app
----- css/      // All styles and style related files (SCSS or LESS files)
----- js/       // JavaScript files written for your app that are not for angular
----- libs/     // Third-party libraries such as jQuery, Moment, Underscore, etc.
index.html