Angular的大小写风格规范

官网地址:https://angular.io/guide/glossary

Case types

  • camelCase: Symbols, properties, methods, pipe names, non-component directive selectors, constants. Standard or lower camel case uses lowercase on the first letter of the item. For example, “selectedHero”. 首字母必须小写。

参考下图高亮的例子:

Angular的大小写风格规范

  • UpperCamelCase (or PascalCase): Class names, including classes that define components, interfaces, NgModules, directives, and pipes, Upper camel case uses uppercase on the first letter of the item. For example, “HeroListComponent”.

参考下图高亮的例子:

Angular的大小写风格规范

  • dash-case (or “kebab-case”): 用于定义文件名,以及selector:

Angular的大小写风格规范

  • underscore_case (or “snake_case”): 例如"convert_link_mode". 在Angular中不常用。

  • UPPER_UNDERSCORE_CASE (or UPPER_SNAKE_CASE, or SCREAMING_SNAKE_CASE): 用于定义常量。

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
Angular的大小写风格规范