How to change placeholder in ngx-treeview

1.2k Views Asked by At

How can we change the placeholder of treeview, using an appropriate method

providers: [
 {
   provide: TreeviewI18n, useValue: Object.assign(new TreeviewI18nDefault(),{
    getFilterPlaceholder(): string {
       return ' search Library ...';
    }
  })
 }
]

With the above method, I am achieving the same but seems it's breaking up in production time, I mean if there is any better way to change the placeholder text

enter image description here

1

There are 1 best solutions below

3
On

actually ngx-treeview rename TreeviewI18nDefault() class to DefaultTreeviewI18n() you can change this class and use it to change placeholders

you can use this code on your shared module or component

import {
    DefaultTreeviewI18n, DropdownTreeviewComponent, TreeviewI18n, TreeviewModule,
} from 'ngx-treeview';



providers: [
    DropdownTreeviewComponent,
    {
        provide: TreeviewI18n, useValue: Object.assign(new DefaultTreeviewI18n(), {
            getFilterPlaceholder(): string {
                return 'your custom placeholder';
            },
            getAllCheckboxText(): string {
                return 'your custom placeholder';
            },
            getFilterNoItemsFoundText(): string {
                return 'your custom placeholder';
            },
        }),
    }
]

you can use some other method if you want , there is a list of other methods here