Alerts

{{ alert?.msg }}


<alert *ngFor="let alert of alerts;let i = index"
    [type]="alert.type"
    [dismissible]="alert?.closable"
    (close)="closeAlert(i)">
        { { alert.msg } }
</alert>
        

@Component()
export class AlertsPreviewComponent implements OnInit {
    constructor() {
    }

    ngOnInit() {
    }

    /*----------------------------------------------------------
     * ALERTS
     *---------------------------------------------------------*/
    public alerts: Object[] = [
        {
            type: 'danger',
            msg:  'Oh snap! Change a few things up and try submitting again.'
        },
        {
            type:     'success',
            msg:      'Well done! You successfully read this important alert message.',
            closable: true
        },
        {
            type:     'info',
            msg:      'Well done! You successfully read this important alert message.',
            closable: true
        },
        {
            type:     'warning',
            msg:      'Well done! You successfully read this important alert message.',
            closable: true
        }
    ];

    public closeAlert(i: number): void {
        this.alerts.splice(i, 1);
    }

}