是否存在 Angularjs 代码/命名约定? [英] Exists Angularjs code/naming conventions?

查看:25
本文介绍了是否存在 Angularjs 代码/命名约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道在我们构建应用程序时是否存在任何官方或最被接受的 Angular 命名约定参考?

Does anyone know if exists any official or most accepted reference for Angular naming conventions to use when we build our applications?

Angular 有许多不同类型的组件,例如过滤器指令服务等等.

Angular has many different types of components such as filters, directives, services, and so on.

您是否同意在我们的应用程序中实现引用命名约定有意义?

Wouldn't you agree that having a reference naming convention when we implement them in our applications will make sense?

例如:如果我们需要创建新的过滤器,我们应该如何将它们命名为 [Something]Filter 或 filter[Something] 或其他名称?这同样适用于控制器、服务、指令等.我想知道属于范围的变量/函数是否应该具有特定的前缀或后缀.在某些情况下,有一种方法可以将它们与函数和其他(非角度代码)区分开来.

For example: If we need to create new filters, how should we name them like [Something]Filter or filter[Something] or something else? And same applies to Controllers, Services, Directives, and so on. I wonder if variables/functions that belong to the scope should have a particular prefix or suffix. In some situations, it may be useful to have a way to differentiate them from functions and other (none angular code).

推荐答案

查看 这个 GitHub 存储库 描述了 AngularJS 应用程序的最佳实践.它有不同组件的命名约定.它并不完整,但它是由社区驱动的,因此每个人都可以做出贡献.

Check out this GitHub repository that describes best practices for AngularJS apps. It has naming conventions for different components. It is not complete, but it is community-driven so everyone can contribute.

这篇关于是否存在 Angularjs 代码/命名约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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