mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-16 23:40:14 +01:00
fix(docs): async md load
This commit is contained in:
parent
e77829a465
commit
0026c02fdf
7 changed files with 73 additions and 33 deletions
|
|
@ -5,19 +5,34 @@
|
|||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-md-block',
|
||||
template: `
|
||||
<nb-card *ngFor="let section of source;" [ngxFragment]="section.fragment">
|
||||
<nb-card *ngFor="let section of content;" [ngxFragment]="section.fragment">
|
||||
<nb-card-body>
|
||||
<div [innerHtml]="section.html"></div>
|
||||
<div [innerHtml]="getTemplate(section.html)"></div>
|
||||
</nb-card-body>
|
||||
</nb-card>
|
||||
`,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class NgxMdBLockComponent {
|
||||
@Input() content: MdChildren[] = [];
|
||||
|
||||
@Input() source: string;
|
||||
constructor(private readonly domSanitizer: DomSanitizer) {
|
||||
}
|
||||
|
||||
// TODO: create NbDOMPurifyPipe
|
||||
getTemplate(content: string): SafeHtml {
|
||||
return this.domSanitizer.bypassSecurityTrustHtml(content);
|
||||
}
|
||||
}
|
||||
|
||||
interface MdChildren {
|
||||
fragment: string;
|
||||
html: string;
|
||||
source: string;
|
||||
title: string;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue