Skip to content

Commit

Permalink
build: update icon dependency (#3776)
Browse files Browse the repository at this point in the history
* build: update icon dependency
* fix: constructor
  • Loading branch information
Wendell authored Jul 12, 2019
1 parent 0ff765b commit 979807d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
18 changes: 8 additions & 10 deletions components/icon/nz-icon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import { DOCUMENT } from '@angular/common';
import { HttpBackend } from '@angular/common/http';
import { Inject, Injectable, InjectionToken, Optional, RendererFactory2 } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { IconDefinition, IconService } from '@ant-design/icons-angular';
import {
BarsOutline,
Expand Down Expand Up @@ -137,11 +136,11 @@ export class NzIconService extends IconService {

fetchFromIconfont(opt: NzIconfontOption): void {
const { scriptUrl } = opt;
if (this.document && !this.iconfontCache.has(scriptUrl)) {
if (this._document && !this.iconfontCache.has(scriptUrl)) {
const script = this._renderer.createElement('script');
this._renderer.setAttribute(script, 'src', scriptUrl);
this._renderer.setAttribute(script, 'data-namespace', scriptUrl.replace(/^(https?|http):/g, ''));
this._renderer.appendChild(this.document.body, script);
this._renderer.appendChild(this._document.body, script);
this.iconfontCache.add(scriptUrl);
}
}
Expand All @@ -151,15 +150,14 @@ export class NzIconService extends IconService {
}

constructor(
protected rendererFactory: RendererFactory2,
protected sanitizer: DomSanitizer,
@Optional() protected handler: HttpBackend,
// tslint:disable-next-line:no-any
@Optional() @Inject(DOCUMENT) protected document: any,
rendererFactory: RendererFactory2,
@Optional() @Inject(NZ_ICONS) private icons: IconDefinition[],
@Optional() @Inject(NZ_ICON_DEFAULT_TWOTONE_COLOR) private defaultColor: string
@Optional() @Inject(NZ_ICON_DEFAULT_TWOTONE_COLOR) private defaultColor: string,
@Optional() handler: HttpBackend,
// tslint:disable-next-line:no-any
@Optional() @Inject(DOCUMENT) document: any
) {
super(rendererFactory, handler, document, sanitizer);
super(rendererFactory, handler, document);

this.addIcon(...NZ_ICONS_USED_BY_ZORRO, ...(this.icons || []));

Expand Down
4 changes: 2 additions & 2 deletions components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"url": "https://github.com/NG-ZORRO/ng-zorro-antd/issues"
},
"dependencies": {
"date-fns": "^1.30.1",
"@angular/cdk": "^8.0.0",
"@ant-design/icons-angular": "^8.0.0"
"@ant-design/icons-angular": "^8.0.1",
"date-fns": "^1.30.1"
},
"peerDependencies": {
"@angular/animations": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"dependencies": {
"@angular/cdk": "^8.0.0",
"@ant-design/icons-angular": "^8.0.0",
"@ant-design/icons-angular": "^8.0.1",
"date-fns": "^1.30.1"
},
"devDependencies": {
Expand Down

0 comments on commit 979807d

Please sign in to comment.