This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createDeepTruthChecker(useStrategy = Object.keys) { | |
return function check(obj) { | |
return !!obj && ( | |
typeof obj === 'object' | |
? useStrategy(obj).every(key => check(obj[key])) | |
: true | |
); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hero { | |
constructor(public name: string, public weapon?: string) {} | |
} | |
class Avengers { | |
private ensemble: Hero[] = []; | |
private blast(hero: Hero) { | |
console.log(`${hero.name} blasted ${hero.weapon}`); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Hero { | |
constructor(public name: string, public weapon?: string) {} | |
abstract attack(): void; | |
} | |
class BlastingHero extends Hero { | |
attack() { | |
console.log(`${this.name} blasted ${this.weapon}.`); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DomInsertionService, CONTENT_STRATEGY } from '@abp/ng.core'; | |
@Component({ | |
/* class metadata here */ | |
}) | |
class DemoComponent { | |
constructor(private domInsertionService: DomInsertionService) {} | |
ngOnInit() { | |
const scriptElement = this.domInsertionService.insertContent( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ContentSecurityStrategy, | |
CONTENT_SECURITY_STRATEGY, | |
} from './content-security.strategy'; | |
import { DomStrategy, DOM_STRATEGY } from './dom.strategy'; | |
export abstract class ContentStrategy<T extends HTMLScriptElement | HTMLStyleElement = any> { | |
constructor( | |
public content: string, | |
protected domStrategy: DomStrategy = DOM_STRATEGY.AppendToHead(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { ContentStrategy } from '../strategies/content.strategy'; | |
import { generateHash } from '../utils'; | |
@Injectable({ providedIn: 'root' }) | |
export class DomInsertionService { | |
private readonly inserted = new Set<number>(); | |
insertContent<T extends HTMLScriptElement | HTMLStyleElement>( | |
contentStrategy: ContentStrategy<T>, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ngx-datatable | |
[rows]="data$ | async" | |
[count]="totalCount$ | async" | |
[loadingIndicator]="list.isLoading$ | async" | |
[limit]="list.maxResultCount" | |
[offset]="list.page" | |
(page)="list.page = $event.offset" | |
(sort)="sort($event)" | |
[externalPaging]="true" | |
[externalSorting]="true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ngx-datatable | |
[rows]="data$ | async" | |
[count]="totalCount$ | async" | |
[list]="list" | |
default | |
> | |
<!-- templates here --> | |
</ngx-datatable> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
// tslint:disable-next-line | |
selector: 'ngx-datatable[list]', | |
exportAs: 'ngxDatatableList', | |
}) | |
export class NgxDatatableListDirective implements OnChanges, OnDestroy, OnInit { | |
private subscription = new Subscription(); | |
@Input() list: ListService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
// tslint:disable-next-line | |
selector: 'ngx-datatable[default]', | |
exportAs: 'ngxDatatableDefault', | |
}) | |
export class NgxDatatableDefaultDirective { | |
@Input() class = 'material bordered'; | |
@HostBinding('class') | |
get classes(): string { |