File

projects/rebirth-ng/src/lib/alert-box/alert-box.component.ts

Metadata

changeDetection ChangeDetectionStrategy.OnPush
exportAs alertBox
selector re-alert-box
styleUrls alert-box.component.scss
templateUrl ./alert-box.component.html

Index

Methods
Inputs
Outputs

Constructor

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

Inputs

closable

Type: boolean

cssClass

Type: string

removeIcon

Type: string

type

Type: "success" | "info" | "warning" | "danger"

Default value: 'info'

Outputs

close $event type: EventEmitter

Methods

closeBox
closeBox()
Returns : void
Private onCloseBox
onCloseBox()
Returns : void
import { Component, Input, Output, EventEmitter, ChangeDetectionStrategy } from '@angular/core';
import { RebirthNGConfig } from '../rebirth-ng.config';

@Component({
  selector: 're-alert-box',
  templateUrl: './alert-box.component.html',
  styleUrls: ['./alert-box.component.scss'],
  exportAs: 'alertBox',
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class AlertBoxComponent {
  @Input() removeIcon: string;
  @Input() type: 'success' | 'info' | 'warning' | 'danger' = 'info';
  @Input() cssClass: string;
  @Input() closable: boolean;
  @Output() close = new EventEmitter<any>();

  constructor(rebirthNGConfig: RebirthNGConfig) {
    this.type = <any>rebirthNGConfig.alertBox.type;
    this.closable = rebirthNGConfig.alertBox.closable;
    this.removeIcon = rebirthNGConfig.alertBox.removeIcon;
  }

  closeBox() {
    this.onCloseBox();
  }

  private onCloseBox() {
    this.close.emit(this);
  }
}
<div class="alert alert-{{type}} {{cssClass}}" [ngClass]="{'alert-dismissible': closable}" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close" *ngIf="closable" (click)="closeBox()">
    <span aria-hidden="true" class="alert-remove-icon {{removeIcon}}"></span>
  </button>
  <ng-content></ng-content>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""