本文介绍了与角JS组合的Grails 2.3.4智能文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是不使用的Grails angularjs插件的Grails 2.3.4结合angularjs智能文件夹结构?

What would be an intelligent folder structure for grails 2.3.4 in combination with angularjs without using the grails angularjs plugin?

目前我已经都打包到 web应用程序文件夹中。

Currently I have packed everything into the webapp folder.

推荐答案

有许多方法来组织你的目录,但是,我们使用的是哪个我会的方式,把它Grailsy方式在某种程度上是一致Grails的目录结构如下:

There are many ways to organize your directories, however, the way we are using, which I'm gonna call it Grailsy way and to some extend is consistent with Grails directory structure is as follow:

web-app
  css
  js
   |  lib 
   |  ng-app
        |  controllers
           - abcController.js 
        |  directives
           - directives.js
        |  filters
           - filters.js
        |  services
           - dataServices.js
        |  views 
           - someHtml.html
        |  app.js

LIB 拥有所有的角图书馆,我们也分开了角组件集成到类似于Grails和它运作良好不同的文件夹。

the lib has all the angular libraries and we also separated our angular components into different folders similar to Grails and its working well.

然而,另一种方法是根据你的模块来组织你的目录。这种方法是presented ,似乎是有希望的较大的应用程序。基本目录是你的单页上重新presenting组件。这将是很容易找到并在目录少搬动了相关的组件资源。

However, an alternative approach is to organize your directories based on your modules. This approach is presented here and seems to be promising for larger applications. Basically the directories are representing components on your single page. It will be easy to find and less moving across directories for resources related to a component.

web-app
      css
      js
       |  lib 
       |  ng-app
            |  accounts
               - accountController.js 
               - accountServices.js
               - views 
                 - someHtml.html
            |  payments
               - paymentsController.js 
               - paymentsServices.js
               - views 
                 - someHtml.html
            |  app.js

先进的设计模式和最佳实践 是角的最佳实践有很大的参考

"Advanced Design Patterns and Best Practices" is a great reference for angular best practices

这篇关于与角JS组合的Grails 2.3.4智能文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!