Skip to content

Commit

Permalink
docs: clarify pipe naming (#31806)
Browse files Browse the repository at this point in the history
PR Close #31806
  • Loading branch information
jbogarthyde authored and kara committed Aug 9, 2019
1 parent 6f3414b commit 3300331
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions aio/content/guide/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,10 @@ For example, the prefix `toh` represents **T**our **o**f **H**eroes and the pref


**Do** use consistent names for all pipes, named after their feature.
The pipe class name should use [UpperCamelCase](guide/glossary#case-types)
(the general convention for class names),
and the corresponding `name` string should use *lowerCamelCase*.
The `name` string cannot use hyphens ("dash-case" or "kebab-case").


</div>
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/metadata/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,8 @@ export interface PipeDecorator {
* to a template. To make it a member of an NgModule,
* list it in the `declarations` field of the `NgModule` metadata.
*
* @see [Style Guide: Pipe Names](guide/styleguide#02-09)
*
*/
(obj: Pipe): TypeDecorator;

Expand All @@ -606,7 +608,8 @@ export interface PipeDecorator {
export interface Pipe {
/**
* The pipe name to use in template bindings.
*
* Typically uses [lowerCamelCase](guide/glossary#case-types)
* because the name cannot contain hyphens.
*/
name: string;

Expand Down

0 comments on commit 3300331

Please sign in to comment.