idk
This commit is contained in:
23
src/app/child-1/child-1.component.ts
Normal file
23
src/app/child-1/child-1.component.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import {Component, EventEmitter, Input, Output} from "@angular/core";
|
||||
|
||||
@Component({
|
||||
selector: 'app-child-1',
|
||||
standalone: true,
|
||||
template: `
|
||||
<h1>{{balance}}€</h1>
|
||||
<button (click)="minusFifty()" [disabled]="balance <= 0">-50€</button>
|
||||
<h2 [hidden]="balance > 0">No mo money</h2>
|
||||
`
|
||||
})
|
||||
export class Child1Component {
|
||||
@Input()
|
||||
public balance: number = 1000;
|
||||
|
||||
@Output()
|
||||
public balanceChange: EventEmitter<number> = new EventEmitter<number>();
|
||||
|
||||
public minusFifty() {
|
||||
this.balance -= 50;
|
||||
this.balanceChange.emit(this.balance);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user