AngularJS文件夹结构 [英] AngularJS Folder Structure

查看:416
本文介绍了AngularJS文件夹结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何布置一个文件夹结构为大,可扩展的应用AngularJS?

How do you layout a folder structure for a large and scaleable AngularJS application?

推荐答案

在左边,我们有按类型组织的应用程序。不算太糟糕较小的应用程序,但即使在这里,你可以开始看到它变得更加困难找到你在找什么。当我想找到一个特定的视图及其控制器,它们在不同的文件夹中。它可以很好地从这里开始,如果你不知道怎么回事组织code,因为它是很容易转移到右边的技术:通过功能结构

On the left we have the app organized by type. Not too bad for smaller apps, but even here you can start to see it gets more difficult to find what you are looking for. When I want to find a specific view and its controller, they are in different folders. It can be good to start here if you are not sure how else to organize the code as it is quite easy to shift to the technique on the right: structure by feature.

在右侧的项目是由功能组织。所有的布局视图和控制器走在布局文件夹时,管理内容的推移在管理文件夹中,被所有的领域中使用的服务,在服务的文件夹中去。这里的想法是,当你正在寻找code,使一个功能的工作,它坐落在一个地方。服务是因为他们服务的许多功能有点不同。我喜欢这一次我的应用程序启动,因为它成为一个更容易管理,我初具规模。

On the right the project is organized by feature. All of the layout views and controllers go in the layout folder, the admin content goes in the admin folder, and the services that are used by all of the areas go in the services folder. The idea here is that when you are looking for the code that makes a feature work, it is located in one place. Services are a bit different as they "service" many features. I like this once my app starts to take shape as it becomes a lot easier to manage for me.

一个写得很好的博客文章:<一href=\"http://www.johnpapa.net/angular-growth-structure/\">http://www.johnpapa.net/angular-growth-structure/

A well written blog post: http://www.johnpapa.net/angular-growth-structure/

示例应用程序: https://github.com/angular-app/angular-app <​​/A>

Example App: https://github.com/angular-app/angular-app

这篇关于AngularJS文件夹结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆