projects/rebirth-ng/src/lib/notify/notify.component.ts
host | { |
selector | re-notify |
styleUrls | notify.component.scss |
templateUrl | ./notify.component.html |
Methods |
Inputs |
constructor(rebirthNGConfig: RebirthNGConfig)
|
||||||
Parameters :
|
cssClass
|
Type: |
notifies
|
Type:
Default value: |
placement
|
Type: |
width
|
Type: |
close | ||||
close(item: )
|
||||
Parameters :
Returns :
void
|
import { Component, Input } from '@angular/core';
import { NotifyModel } from './notify.model';
import { RebirthNGConfig } from '../rebirth-ng.config';
@Component({
selector: 're-notify',
templateUrl: './notify.component.html',
styleUrls: ['./notify.component.scss'],
host: {
'[style.width]': 'width',
'[class]': '(placement ? "alert-" + placement : "") + " " + (cssClass || "")',
}
})
export class NotifyComponent {
@Input() notifies: NotifyModel[] = [];
@Input() width: string;
@Input() cssClass: string;
@Input() placement: 'top' | 'top-right' | 'bottom' | 'bottom-right' | 'center';
constructor(private rebirthNGConfig: RebirthNGConfig) {
this.placement = <any>rebirthNGConfig.alertBoxPanel.placement;
this.cssClass = rebirthNGConfig.alertBoxPanel.cssClass;
this.width = rebirthNGConfig.alertBoxPanel.width;
}
close(item) {
this.notifies = this.notifies.filter((box) => box !== item);
}
}
<re-alert-box *ngFor="let item of notifies" [type]="item.type" [closable]="true" (close)="close(item)">
<div *ngIf="!item.template" [innerHTML]="item.html"></div>
<ng-template *ngIf="item.template" [ngTemplateOutlet]="item.template"
[ngTemplateOutletContext]="{ $implicit: item }"></ng-template>
</re-alert-box>