mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-17 16:00:14 +01:00
feat: demo version additions
This commit is contained in:
parent
0eec54695f
commit
eee950248e
322 changed files with 23456 additions and 188 deletions
|
|
@ -0,0 +1,43 @@
|
|||
import {
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
Input,
|
||||
} from '@angular/core';
|
||||
import { NgxCodeLoaderService } from '../../../@theme/services/code-loader.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ngx-example-block',
|
||||
template: `
|
||||
<ngx-code-block *ngIf="code"
|
||||
[firstLine]="firstLine"
|
||||
[lastLine]="lastLine"
|
||||
[code]="code">
|
||||
</ngx-code-block>
|
||||
`,
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class NgxExampleBlockComponent {
|
||||
|
||||
code: string;
|
||||
firstLine: number;
|
||||
lastLine: number;
|
||||
|
||||
@Input('content')
|
||||
set setContent(content) {
|
||||
this.loadCode(content);
|
||||
}
|
||||
|
||||
constructor(private codeLoader: NgxCodeLoaderService, private cd: ChangeDetectorRef) {
|
||||
}
|
||||
|
||||
loadCode(content) {
|
||||
this.codeLoader.load(content.files[0])
|
||||
.subscribe((code: string) => {
|
||||
this.code = code;
|
||||
this.firstLine = content.firstLine || 1;
|
||||
this.lastLine = content.lastLine || code.split('\n').length;
|
||||
this.cd.detectChanges();
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue