@ng-icons/ionicons 25.4.0 → 25.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +18 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -157,7 +157,7 @@ import { featherAirplay } from '@ng-icons/feather-icons';
157
157
  providers: [
158
158
  provideNgIconsConfig({
159
159
  size: '1.5em',
160
- color: 'red'
160
+ color: 'red',
161
161
  }),
162
162
  ],
163
163
  })
@@ -181,3 +181,20 @@ bootstrapApplication(AppComponent, {
181
181
  ],
182
182
  });
183
183
  ```
184
+
185
+ ### Dynamically Loading Icons
186
+
187
+ The most common way to load icons is simply by registering them individually, however you may want to load icons lazily from a URL, or generate an SVG programatically on the fly. This can be achived using an icon loader. Icon loaders are a function that receives the name of the requested icon, and can return an `Observable<string>`, `Promise<string>` or a `string` containing the SVG to render. Within this function you can do whatever you need to retrieve an icon.
188
+
189
+ The function is also run within the injection context, this allows you to inject dependencies as you need such as the `HttpClient`.
190
+
191
+ ```ts
192
+ bootstrapApplication(AppComponent, {
193
+ providers: [
194
+ provideNgIconLoader(name => {
195
+ const http = inject(HttpClient);
196
+ return http.get(`/assets/icons/${name}.svg`);
197
+ }),
198
+ ],
199
+ });
200
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ng-icons/ionicons",
3
- "version": "25.4.0",
3
+ "version": "25.5.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.2.0"
6
6
  },