` to create all the files for a new pipe
Create a `src/app/pipes/exclamation.pipe.ts` file with the following contents:
```ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'exclamation'
})
export class ExclamationPipe implements PipeTransform {
transform(value: any, args?: any): any {
* return \`${value}!`;
}
}
```
---
### Using a pipe
.breadcrumbs[Advanced Angular > Custom pipes]
To use your new pipe, you must **declare** it in your module's `declarations` array in `src/app/app.module.ts`:
```ts
// Other imports...
*import { ExclamationPipe } from './pipes/exclamation.pipe';
@NgModule({
declarations: [
AppComponent,
HighlightDirective,
`ExclamationPipe`
],
// ...
})
export class AppModule { }
```
Using the pipe is as simple as "piping" an interpolated value into it with the pipe (`|`) character in a template.
You can do that in `src/app/app.component.html`, then type some text in the input field to see it:
```html
{{ hello(greeting)` | exclamation` }}
```
---
### Pipe parameters
.breadcrumbs[Advanced Angular > Custom pipes]
Pipe can also take **parameters**.
Let's add a number parameter to allow customizing the number of exclamation points in `src/app/pipes/exclamation.pipe.ts`:
```ts
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'exclamation'
})
export class ExclamationPipe implements PipeTransform {
transform(value: any`, strength: number = 1`): any {
* const exclamation = '!'.repeat(strength);
* return \`${value}${exclamation}`;
}
}
```
Parameters are passed to pipes by appending `:value` to them in the template in `src/app/app.component.html`:
```html
{{ hello(greeting) | exclamation`:3` }}
```
---
## Resources
.breadcrumbs[Advanced Angular]
**Documentation**
* [Angular Tour of Heroes Tutorial][angular-tour-of-heroes]
* [Angular Developer Guide][angular-guide]
* [Angular API reference][angular-api]
[angular]: https://angular.io
[angular-api]: https://angular.io/api
[angular-docs-directive]: https://angular.io/api/core/Directive
[angular-guide]: https://angular.io/guide/architecture
[angular-subject]: ../angular
[angular-tour-of-heroes]: https://angular.io/tutorial
[chrome]: https://www.google.com/chrome/
[css-attribute-selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors