Skip to content

Commit

Permalink
fix(module: ActionSheet): fix when no title or message would not show…
Browse files Browse the repository at this point in the history
… blank on header (#192)
  • Loading branch information
Guoyuanqiang authored and fisherspy committed Dec 25, 2018
1 parent 23f36c1 commit b0f41b7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions components/action-sheet/action-sheet.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
</button>
<div class="{{props.prefixCls}}-body">
<div>
<ng-template *ngIf="isTemplateRef(title)" [ngTemplateOutlet]="title"></ng-template>
<h3 *ngIf="!isTemplateRef(title)" class="{{props.prefixCls}}-title">{{title}}</h3>
<ng-template *ngIf="isTemplateRef(message)" [ngTemplateOutlet]="message"></ng-template>
<div *ngIf="!isTemplateRef(message)" class="{{props.prefixCls}}-message">{{message}}</div>
<ng-container *ngIf="!isNoTitle(title)">
<ng-template *ngIf="isTemplateRef(title)" [ngTemplateOutlet]="title"></ng-template>
<h3 *ngIf="!isTemplateRef(title)" class="{{props.prefixCls}}-title">{{title}}</h3>
</ng-container>
<ng-container *ngIf="!isNoTitle(title)">
<ng-template *ngIf="isTemplateRef(message)" [ngTemplateOutlet]="message"></ng-template>
<div *ngIf="!isTemplateRef(message)" class="{{props.prefixCls}}-message">{{message}}</div>
</ng-container>
<ng-container [ngSwitch]="flag">
<div *ngSwitchCase="'NORMAL'" class="{{props.prefixCls}}-button-list" role="group">
<ng-container *ngFor="let item of options; let i = index;">
Expand Down
4 changes: 4 additions & 0 deletions components/action-sheet/action-sheet.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class ActionSheetComponent {
return cls;
}

isNoTitle(value: string | TemplateRef<any>) {
return value === '' || value === null || value === undefined;
}

isTemplateRef(value) {
if (value) {
return value instanceof TemplateRef;
Expand Down

0 comments on commit b0f41b7

Please sign in to comment.