You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`addIcon()`| To import icons statically |`IconDefinition`|
37
37
|`addIconLiteral()`| To statically import custom icons |`string`, `string (SVG)`|
38
-
|`fetchFromIconfont()`| To get icon assets from fonticon|`NzIconfontOption`|
38
+
|`fetchFromIconfont()`| To get icon assets from iconfont|`NzIconfontOption`|
39
39
|`changeAssetsSource()`| To change the location of your icon assets, so that you can deploy these icons wherever you want |`string`|
40
40
41
41
### SVG icons
@@ -49,16 +49,18 @@ We synced to Ant Design and replaced font icons with svg icons which bring benef
49
49
50
50
You can join in [this discussion of Ant Design](https://github.com/ant-design/ant-design/issues/10353).
51
51
52
-
NG-ZORRO hadn't provided an icon component. Instead, icon based on font files was provided. We make this new directive compatible to old API. If you make no changes to your existing code, old icons would be dynamically loaded as `outline`icons. But the best practice is always to use `nz-icon` directive and specify the `theme` prop.
52
+
NG-ZORRO hadn't provided an icon component at the beginning. Instead, icon based on font files was provided.
53
+
We make this new directive compatible to old API. If you make no changes to your existing code, old icons would be dynamically loaded as `outline`icons.
54
+
But the best practice is always to use `nz-icon` component and specify the `theme` prop.
Actually this calls `addIcon` of `NzIconService`. Icons imported would be bundled into your `.js` files. Static loading would increase your bundle's size so we recommend use dynamic importing as much as you can.
107
+
Actually this calls `addIcon` of `NzIconService`. Icons imported would be bundled into your `.js` files. Static loading
108
+
would increase your bundle's size so we recommend use dynamic importing as much as you can.
106
109
107
-
> Icons used by `NG-ZORRO` itself are imported statically to increase loading speed. However, icons demonstrated on the official website are loaded dynamically.
110
+
> Icons used by `NG-ZORRO` itself are imported statically to increase loading speed. However, icons demonstrated on the
111
+
> official website are loaded dynamically.
108
112
109
-
Dynamic importing. This way would not increase your bundle's size. When NG-ZORRO detects that the icon you want to render hasn't been registered, it would fire a HTTP request to load it. All you have to do is to config your `angular.json` like this:
113
+
Dynamic importing. This way would not increase your bundle's size. When NG-ZORRO detects that the icon you want to
114
+
render hasn't been registered, it would fire a HTTP request to load it. All you have to do is to config your
115
+
`angular.json` like this:
110
116
111
117
```json
112
118
{
@@ -120,9 +126,11 @@ Dynamic importing. This way would not increase your bundle's size. When NG-ZORRO
120
126
}
121
127
```
122
128
123
-
You can call `changeAssetsSource()` of `NzIconService` to change the location of your icon assets, so that you can deploy these icon assets to cdn. The parameter you passed would be add in front of `assets/`.
129
+
You can call `changeAssetsSource()` of `NzIconService` to change the location of your icon assets, so that you can
130
+
deploy these icon assets to cdn. The parameter you passed would be add in front of `assets/`.
124
131
125
-
Let's assume that you deploy static assets under `https://mycdn.somecdn.com/icons/assets`. You can call `changeAssetsSource('https://mycdn.somecdn.com/icons')` to tell NG-ZORRO that all your resources are located there.
132
+
Let's assume that you deploy static assets under `https://mycdn.somecdn.com/icons/assets`. You can call
133
+
`changeAssetsSource('https://mycdn.somecdn.com/icons')` to tell NG-ZORRO that all your resources are located there.
126
134
127
135
Please call this in component's constructor or `AppInitService`.
128
136
@@ -134,7 +142,7 @@ Sometimes, you want to import icons in lazy modules to avoid increasing the size
0 commit comments