Last active
July 29, 2024 14:04
-
-
Save amimaro/0bd7acf587325bddc83a75f650f7f046 to your computer and use it in GitHub Desktop.
Toggle Bulma Modal with Angular 5
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
Toggle Bulma Modal with Angular 5 |
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
<div class="modal" [ngClass]="{ 'is-active' : isModalActive }"> | |
<div class="modal-background" (click)="toggleModal()"></div> | |
<div class="modal-card"> | |
<header class="modal-card-head"> | |
<p class="modal-card-title">Modal title</p> | |
<button class="delete" aria-label="close" (click)="toggleModal()"></button> | |
</header> | |
<section class="modal-card-body"> | |
<!-- Content ... --> | |
</section> | |
<footer class="modal-card-foot"> | |
<button class="button is-success">Save changes</button> | |
<button class="button" (click)="toggleModal()">Cancel</button> | |
</footer> | |
</div> | |
</div> |
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
import { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-my-component', | |
templateUrl: './my-component.component.html', | |
styleUrls: ['./my-component.component.css'] | |
}) | |
export class MyComponent implements OnInit { | |
isModalActive: boolean = false; | |
constructor() { } | |
ngOnInit() { | |
} | |
toggleModal() { | |
this.isModalActive = !this.isModalActive; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank You For This ... I was looking for a solution like this