In Angular, can I pass data in a getter method from parent to child?

Discussão em 'Angular' iniciado por user3472810, Fevereiro 21, 2025.

  1. user3472810

    user3472810 Guest

    In my parent component, I am using the following getter method to paginate data in my child template.

    get paginatedData() {
    const start = (this.currentPage - 1) * (this.itemsPerPage);
    const end = start + this.itemsPerPage

    return this.data.slice(start, end);
    }


    I want to use the values of 'start' and 'end' in an html element in the child component.

    Items {{start}}-{{end}} of {{totalItems}}


    Is it possible to pass data in a getter method from parent to child? I want to access the 'start' and 'end' properties.

    Continue reading...

Compartilhe esta Página