nts-ng2-components
Version:
Paquete de componentes para Angular2 desarrollado por NITSNETS.
33 lines (32 loc) • 1.76 kB
HTML
<ng-container *ngIf="!customCell">
<ng-container *ngIf="value" [ngSwitch]="format">
<ng-container *ngSwitchCase="'text'"> {{value}} </ng-container>
<ng-container *ngSwitchCase="'strong'"> <strong>{{value}}</strong> </ng-container>
<ng-container *ngSwitchCase="'p'"> <p>{{value}}</p> </ng-container>
<ng-container *ngSwitchCase="'h1'"> <h1>{{value}}</h1> </ng-container>
<ng-container *ngSwitchCase="'h2'"> <h2>{{value}}</h2> </ng-container>
<ng-container *ngSwitchCase="'h3'"> <h3>{{value}}</h3> </ng-container>
<ng-container *ngSwitchCase="'h4'"> <h4>{{value}}</h4> </ng-container>
<ng-container *ngSwitchCase="'html'"> <div [innerHtml]="value"></div> </ng-container>
<ng-container *ngSwitchCase="'image'"> <img [src]="value"> </ng-container>
<ng-container *ngSwitchCase="'progress'">
<nts-progress [value]="value" [color]="options?.color" [total]="options?.total"></nts-progress>
</ng-container>
<ng-container *ngSwitchCase="'badge'">
<nts-badge [label]="value" [color]="options?.color"></nts-badge>
</ng-container>
<!-- You can add a new format cases here
<ng-container *ngSwitchCase="'yourCase'">
The content of your custom cell.
The value of the cell is at {{value}} and the options at {{options}}
</ng-container>
-->
<ng-container *ngSwitchDefault>
{{value | format: format}}
</ng-container>
</ng-container>
<ng-content *ngIf="!value"></ng-content>
</ng-container>
<ng-container *ngIf="customCell">
<template [ngTemplateOutlet]="customCell" [ngOutletContext]="context"> </template>
</ng-container>