ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
43 lines (39 loc) • 1.25 kB
text/typescript
/* tslint:disable:no-any */
import { DOCUMENT } from '@angular/common';
import {
Component,
Inject,
Input,
OnInit,
Optional,
} from '@angular/core';
import { createNzRootInitializer, NzRootConfig, NZ_ROOT_CONFIG } from './nz-root-config';
export class NzRootComponent implements OnInit {
private _document: Document;
private options: NzRootConfig;
// Extra font definition
nzExtraFontName: string;
nzExtraFontUrl: string;
// Cannot use type annotation here due to https://github.com/angular/angular-cli/issues/2034
// Should be revisited after AOT being made the only option
constructor(
_document: any,
options: any,
) {
this._document = _document;
this.options = options;
}
ngOnInit(): void {
if (this.nzExtraFontName && this.nzExtraFontUrl && !this.options) {
const options: NzRootConfig = { extraFontName: this.nzExtraFontName, extraFontUrl: this.nzExtraFontUrl };
const initializer = createNzRootInitializer(this._document, options);
initializer();
}
}
}