File

projects/rebirth-ng/src/lib/notify/notify.component.ts

Metadata

host {
}
selector re-notify
styleUrls notify.component.scss
templateUrl ./notify.component.html

Index

Methods
Inputs

Constructor

constructor(rebirthNGConfig: RebirthNGConfig)
Parameters :
Name Type Optional
rebirthNGConfig RebirthNGConfig no

Inputs

cssClass

Type: string

notifies

Type: NotifyModel[]

Default value: []

placement

Type: "top" | "top-right" | "bottom" | "bottom-right" | "center"

width

Type: string

Methods

close
close(item: )
Parameters :
Name Optional
item no
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>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""