ng2-encrm-components
Version:
66 lines (61 loc) • 2.01 kB
HTML
<div class="col-xs-12">
<h1 id="alerts">Alerts</h1>
<en-alert *ngFor="let alert of alerts;let i = index" [type]="alert.type"
[dismissible]="alert?.closable" (close)="closeAlert(i)">
{{ alert?.msg }}
</en-alert>
<alert type="danger" dismissible="true">
alert msg
</alert>
<br><br>
<tabset>
<tab heading="HTML">
<pre><code highlight class="html">
<alert *ngFor="let alert of alerts;let i = index"
[type]="alert.type"
[dismissible]="alert?.closable"
(close)="closeAlert(i)">
{ { alert.msg } }
</alert>
</code></pre>
</tab>
<tab heading="TypeScript">
<pre><code highlight class="typescript">
@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);
}
}
</code></pre>
</tab>
</tabset>
</div>