Toggle button
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-toggle-button',
templateUrl: './toggle-button.component.html',
styleUrls: ['./toggle-button.component.css']
})
export class ToggleButtonComponent implements OnInit {
hide = false;
onDisplayButton(){
this.hide = !this.hide;
}
}
<button
(click)="onDisplayButton()"
>
Display Details</button>
<p *ngIf="hide">
This it the paragraph content
</p>