Angularjs code /命名约定 [英] Angularjs code/naming conventions

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

问题描述

有谁知道如果不存在对角命名约定任何官方或最被接受的参考,当我们建立我们的应用程序中使用?

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

角有很多不同类型的组件,如过滤器,指令,服务等的。难道你不同意,有一个参考的命名约定当我们执行他们在我们的应用中才有意义?

Angular has a lot of different type 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?

例如:

如果我们需要创建新的过滤器,我们应该如何命名他们像[某件事]过滤器或过滤[东西]或其他什么东西?

If we need to create new filters how should we name them like [Something]Filter or filter[Something] or something else?

和同样适用于控制器,服务指令等。

And same applies for Controllers, Services, Directives and so on.

其他的事情我不知道的是,如果变量/函数属于范围应该有一个特殊的preFIX或后缀。在某些情况下可能是有用的有一种方法来从功能和其他(无角$ C $三)区分。

Other things I wonder about is if variables/functions that belongs to the scope should have an special 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 code /命名约定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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