Skip to content

Commit

Permalink
chore(demo): small refactor for original resolver (#8788)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Sep 3, 2024
1 parent e38cdb5 commit 760a2ce
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions projects/demo/src/modules/components/icon/examples/5/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Component, inject} from '@angular/core';
import {Component, SkipSelf} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import type {TuiStringHandler} from '@taiga-ui/cdk';
import {TUI_ICON_RESOLVER, TuiIcon} from '@taiga-ui/core';

@Component({
Expand All @@ -13,12 +14,11 @@ import {TUI_ICON_RESOLVER, TuiIcon} from '@taiga-ui/core';
providers: [
{
provide: TUI_ICON_RESOLVER,
useFactory: () => {
const original = inject(TUI_ICON_RESOLVER, {skipSelf: true});

deps: [[new SkipSelf(), TUI_ICON_RESOLVER]],
useFactory(defaultResolver: TuiStringHandler<string>) {
return (name: string) =>
name.startsWith('@tui.')
? original(name)
? defaultResolver(name)
: `/assets/icons/${name}.svg`;
},
},
Expand Down

0 comments on commit 760a2ce

Please sign in to comment.