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

查看:53
本文介绍了是否存在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天全站免登陆