0

In an Array multiple values(List) are coming and i need to clear out the particular list on the basis of a boolean value For example

In Child Component two values are getting passed as below:

<c-child = warninglist = {Alist}></child>


           this.Alist.push({
                            name: 'CCI',
                            variant: 'Warning',
                            aMessage: 'crufs',
                            cbut: false,
                            dOtric: true,
                            mInfo: 'trsdt'
                        });

           this.Alist.push({
                            name: 'CCI',
                            variant: 'Warning',
                            aMessage: 'crufs',
                            cbut: false,
                            dOtric: false,
                            migf: 'trsdt'
                        });


   In child Component Alist is being received in the warninglist

    In Child component how can i clear only the particular value if dOtric is false?? can anyone help me on this.

1 Answer 1

1

In the child component, you can use the filter method to get value with dOtric is false. Playground example.

    warninglistFiltered = [];

    @api
    get warninglist() {
        return this.informationgirl;
    }

    set warninglist(value) { 
        this.warninglistFiltered = value.filter(warning => (warning.dOtric === false));       
    }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .