For Angular5+ Provides alert messaging for your application. Message styling is driven by [Bootstrap](https://getbootstrap.com/).
npm install ngx-bootstrap-alert
npm install ngx-bootstrap-alert
`
Setup
Import `BootstrapAlertModule` into your `app.module`.
`typescript
import { BootstrapAlertModule } from 'ngx-bootstrap-alert';
@NgModule({
...
imports: [
BootstrapAlertModule
],
})
`
Place the `bootstrap-alert` selector at the bottom of your app.component.html
`html
`
Import `BootstrapAlertService` and `BootstrapAlert` into the component you want to intiate the alert.
`typescript
import { BootstrapAlertService, BootstrapAlert } from 'ng-bootstrap-alert';
`
Configuration
The `BootstrapAlert` object offers three exposed configurations.
* `message` The message to be presented to the user
* `type` The type of message. See purpose of type here
* `timeoutInMilliseconds` How long the message will be displayed to the user before it fades away. Default timeout is 3000.
$3
The following message types are avialable. The typess below represent the Bootstrap alert classes.
* alert-success
* alert-info
* alert-warning
* alert-danger
$3
The following locations are available. Pass the location into the `bootstrap-alert` component selector like so:
`html
`
* top-left
* top-center
* top-right
* bottom-left
* bottom-center
* bottom-right
Usage Examples
$3
`typescript
this.bootstrapAlertService.alert(new BootstrapAlert("BootstrapAlert Message!", "alert-success"));
`
$3
`typescript
var alert = new BootstrapAlert("BootstrapAlert Message!", "alert-success");
alert.timeoutInMilliseconds = 1000;
this.bootstrapAlertService.alert(alert);
``