Random
This commit is contained in:
parent
d1db066c74
commit
4c94212b7f
14 changed files with 567 additions and 349 deletions
3
src/app/Child/child.component.html
Normal file
3
src/app/Child/child.component.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
<h1>Child</h1>
|
||||
<p>Balance: {{balance}}</p>
|
||||
<button type="button" (click)=takeMoney() class="btn btn-secondary">Take Money</button>
|
16
src/app/Child/child.component.ts
Normal file
16
src/app/Child/child.component.ts
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { Component, Input, Output, EventEmitter } from "@angular/core";
|
||||
|
||||
@Component({
|
||||
selector: 'app-child',
|
||||
standalone: true,
|
||||
templateUrl: './child.component.html',
|
||||
})
|
||||
export class ChildComponent {
|
||||
@Input() public balance:number = 0;
|
||||
@Output() balanceChange = new EventEmitter<number>();
|
||||
|
||||
public takeMoney() {
|
||||
this.balance -= 50;
|
||||
this.balanceChange.emit(this.balance);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue