core/alert/alert.component.ts

Description

Alert component allows creating alert with complex view.

Implements

OnDestroy Alert

Example

Metadata

Relationships

Used by

Depends on

Alert component

Alert component allows creating alert with complex view.

Usage examples

Basic usage

Example :
@Component({
  selector: 'my-custom',
  templateUrl: './my-custom.component.html'
})
export class MyCustomComponent {
  showAlert = false;
  onClose = () => {
    console.log('on close');
  };
}
Example :
<div>
  <span>This is my-custom view.</span>
  <button type="button" (click)="showAlert=true">Show alert</button>
</div>

<c8y-alert *ngIf="showAlert" [type]="'danger'" [onClose]="onClose">
  <p><span style="color:red">Danger message.</span></p>
  <button type="button" (click)="showAlert=false">Hide alert</button>
</c8y-alert>

Alert with details

Example :
<c8y-alert *ngIf="showAlert" [type]="'warning'">
  <c8y-alert-text>Alert message</c8y-alert-text>
  <c8y-alert-details>Alert details</c8y-alert-details>
</c8y-alert>

<ng-template #text>
  <ng-content select="c8y-alert-text"></ng-content>
  <ng-content></ng-content>
</ng-template>
<ng-template #detailedData>
  <ng-content select="c8y-alert-details"></ng-content>
</ng-template>

results matching ""

    No results matching ""