-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv16-(current).ts
More file actions
31 lines (25 loc) · 840 Bytes
/
v16-(current).ts
File metadata and controls
31 lines (25 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { Component, computed, EventEmitter, Input, Output, signal } from "@angular/core";
import { NgIf } from "@angular/common";
@Component({
selector: "my-component",
standalone: true,
imports: [NgIf],
template: `
<ng-container *ngIf="myDoubledValue() === 10; else notMagic">
<h2>Congrats!</h2>
<p>That's the magic number!</p>
</ng-container>
<ng-template #notMagic>
<p *ngIf="myDoubledValue() > 10">Too high...</p>
<p *ngIf="myDoubledValue() < 10">Too low...</p>
</ng-template>
`,
})
export class MyComponent {
myVal = signal(0);
myDoubledValue = computed(() => this.myVal() * 2);
@Input() set myValue(value: number) {
this.myVal.set(value);
}
@Output() myOutput = new EventEmitter<number>();
}