app.component.ts
import { Component } from '@angular/core';
import { NgbAlert } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
message:String = "";
onAlertClose(ngbAlert:NgbAlert){
this.message = ngbAlert.type + " closed."
}
}
app.component.html
<h4 style="padding-top:25px; padding-bottom:25px;">
Angular Bootstrap - Alert closed event
</h4>
<ng-template [ngIf]="message.length>0">
{{message}}
</ng-template>
<p>
<ngb-alert
#alert
type="warning"
(closed)="onAlertClose(alert)">
<strong>Warning!</strong>
This is an angular bootstrap warning alert.
</ngb-alert>
</p>
- angular - How to use if then condition
- angular - How to use if statement
- angular - Loop through an array of objects
- angular - How to use nested loop
- angular - How to use Button click event
- angular - How to call function on Button click
- angular - How to use ternary operator
- angular - How to generate random number
- angular - How to toggle element visibility
- angular bootstrap - How to show an alert
- angular bootstrap - Dismissible alert
- angular bootstrap - Danger warning success alert
- angular bootstrap - Rating hover event
- angular bootstrap - Readonly & editable Rating
- angular bootstrap - How to show Toast message