taiga-family / taiga-ui

Angular UI Kit and components library for awesome people
https://taiga-ui.dev
Apache License 2.0
3.1k stars 408 forks source link

🐞 - 4.0.0-rc2 - Error when using TUI_NUMBER_FORMAT #7975

Closed KhaledGabr closed 4 days ago

KhaledGabr commented 6 days ago

Playground Link

No response

Description

image

export class TuiNumberFormat extends Observable<TuiNumberFormatSettings> {
    private readonly settings = new ReplaySubject<Partial<TuiNumberFormatSettings>>(1);
    private readonly parent = inject(TUI_NUMBER_FORMAT, {skipSelf: true});

    constructor() {
        super(subscriber =>
            combineLatest([this.parent, this.settings])
                .pipe(map(([parent, settings]) => ({...parent, ...settings})))
                .subscribe(subscriber),
        );
    }

It appears that the error has to do with something there: number-format.directive.ts The error only happens when I provide the token in my app.component.ts

    {
      provide: TUI_NUMBER_FORMAT,
      useValue: { decimalSeparator: '.', thousandSeparator: ',' },
    },

Angular version

18.0.4

Taiga UI version

4.0.0-rc.2

Which browsers have you used?

Which operating systems have you used?

waterplea commented 4 days ago

That token was changed to Observable<TuiNumberFormatSettings> so it can support dynamic i18n. Change your provision to of({ decimalSeparator: '.', thousandSeparator: ',' }). I'll add it to the list of migrations so we can cover this case if possible.