-
-
Save chidumennamdi/4b6e0a91357a038262e7a3a0fe1bb002 to your computer and use it in GitHub Desktop.
This file contains 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
@Component({ | |
selector: 'app-parent', | |
template: ` | |
<my-i [iHuman]="pHuman"></my-i> | |
<button (click)="incrId()">Incr. Id</button> | |
<button (click)="chgName()">Change Name</button> | |
` | |
}) | |
export class PComponent{ | |
pHuman:any = { | |
id:0, | |
name: "Nnamdi" | |
} | |
incrId(){ | |
const id = this.pHuman.id + 1 | |
this.pHuman = {...this.pHuman, id} | |
} | |
chgName(){ | |
const name = "Chidume" | |
this.pHuman = {...this.pHuman, name} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment