diff --git a/src/app/demo-app/todo/home/home.module.ts b/src/app/demo-app/todo/home/home.module.ts index b70dd24e5aa..e9080ffb6ac 100644 --- a/src/app/demo-app/todo/home/home.module.ts +++ b/src/app/demo-app/todo/home/home.module.ts @@ -5,6 +5,7 @@ import { TodoComponent } from './todos/todo/todo.component'; import { TodosFilter } from './todos/todos.pipe'; import { TooltipDirective } from './todos/todo/tooltip.directive'; import { CommonModule } from '@angular/common'; +import { SamplePipe } from './sample.pipe'; @NgModule({ imports: [ @@ -17,7 +18,7 @@ import { CommonModule } from '@angular/common'; }, ]), ], - declarations: [TodosComponent, TodoComponent, TodosFilter, TooltipDirective], + declarations: [SamplePipe, TodosComponent, TodoComponent, TodosFilter, TooltipDirective], exports: [TodosComponent], }) export class HomeModule {} diff --git a/src/app/demo-app/todo/home/sample.pipe.ts b/src/app/demo-app/todo/home/sample.pipe.ts new file mode 100644 index 00000000000..6bfa29f37c6 --- /dev/null +++ b/src/app/demo-app/todo/home/sample.pipe.ts @@ -0,0 +1,15 @@ +import { Pipe, OnDestroy, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'sample', + pure: false, +}) +export class SamplePipe implements PipeTransform, OnDestroy { + transform(val: any): void { + return val; + } + + ngOnDestroy(): void { + console.log('Destroying'); + } +} diff --git a/src/app/demo-app/todo/home/todos/todos.component.html b/src/app/demo-app/todo/home/todos/todos.component.html index cc6010f617e..8ef36df8c35 100644 --- a/src/app/demo-app/todo/home/todos/todos.component.html +++ b/src/app/demo-app/todo/home/todos/todos.component.html @@ -2,6 +2,8 @@ Home Home +
{{ 'Sample text processed by a pipe' | sample }}
+