This is a migrated thread and some comments may be shown as answers.

Valuenormalizer as a regular function

1 Answer 177 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Sarthak
Top achievements
Rank 1
Veteran
Sarthak asked on 15 Sep 2020, 01:49 PM
How do I replace the valuenormalizer arrow function with a regular function.whenever I try to change that getting an error.Cannot read property 'lift' of undefined.

1 Answer, 1 is accepted

Sort by
0
Svet
Telerik team
answered on 17 Sep 2020, 07:28 AM

Hi Sarthak,

Converting the following arrow function:

  public valueNormalizer = (text: Observable<string>) => text.pipe(map((text: string) => {
      return {
          value: this.listItems[this.listItems.length - 1].value + 1,
          text: text
      };
  }));

to a regular function can be done in the following way:

  public valueNormalizer(text: Observable<string>) {
    return text.pipe(
      map((text: string) => {
        return {
          value: this.listItems[this.listItems.length - 1].value + 1,
          text: text
        };
      })
    );
  }

Please check the following example:

https://stackblitz.com/edit/angular-dwd3cv?file=app/app.component.ts

I hope this helps.

Regards,
Svetlin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ComboBox
Asked by
Sarthak
Top achievements
Rank 1
Veteran
Answers by
Svet
Telerik team
Share this question
or