ngx-admin/docs/app/blocks/components/inline-example-block/inline-example-block.component.ts

23 lines
584 B
TypeScript
Raw Normal View History

2021-08-06 18:48:35 +03:00
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
@Component({
selector: 'ngx-inline-example-block',
template: `
<ngx-example-block *ngIf="isOneFile" [content]="content"></ngx-example-block>
<ngx-tabbed-example-block *ngIf="isTabbed" [content]="content"></ngx-tabbed-example-block>
`,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NgxInlineExampleBlockComponent {
@Input() content;
get isOneFile(): boolean {
return !this.isTabbed;
}
get isTabbed(): boolean {
return this.content.files.length > 1;
}
}