Trying to implement toggle functionality in angular so when button is toggled different text is displayed. Error is thrown in my code. Any help? Code below.
HTML
TS
isChecked: boolean;
CodePudding user response:
try something like below
HTML
<tr>
<td>Otto</td>
<td><button >{{isChecked ? 'ACCESS' : 'NO ACCESS'}}</button></td>
<td>
<div >
<input type="checkbox" (change)="getValue()">
</div>
</td>
</tr>
TS
isChecked: boolean = true;
getValue() {
this.isChecked = !this.isChecked;
}
