Have to show one textbox only at a time, if click on toggle need to hide first textbox and need to show second textbox. If I click again need to show first textbox and hide second textbox. Tried below, but unable to display one textbox onload itself...
HTML:
<div><input *ngIf="text1"
id="test1"
type="text"
placeholder="Textbox1"
/>
</div>
<div>
<input *ngIf="text2"
id="test2"
type="text"
placeholder="Textbox2"
/>
</div>
<button (click)="toggle()">Toggle</button>
.ts
toggle() {
this.text1 = !this.text1;
if (this.text1) {
this.text2 = false;
this.text1 = true;
} else {
this.text2 = true;
this.text1 = false;
}
}