Last active
September 28, 2022 12:46
-
-
Save eneajaho/5e59754214db07383c4d2301bbdaf34d to your computer and use it in GitHub Desktop.
Angular component with pipe (user code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Pipe({ name: 'plusOne', standalone: true }) | |
export class PlusOnePipe implements PipeTransform { | |
transform(value: number): number { | |
return value + 1; | |
} | |
} | |
@Component({ | |
selector: "app-root", | |
template: ` | |
<div>{{ count | plusOne }}</div> | |
<button (click)="count = count + 1">Increase</button> | |
`, | |
standalone: true, | |
imports: [PlusOnePipe], | |
}) | |
export class AppComponent { | |
count = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment