Can not evoke method of Primeng method after select html element by custom attribute through @ViewChildern

I’m using Angular framework Primeng p-carousel to show some vacabulary cards. On the vocabulary card, I am using p-inplace to hide some information, before the user try to solve the question, those information remain hidden.I assigned each p-inplace a custom unique attribute wordId inorder to access each specific p-inplace when user clicked the p-inplace’s show button, because by default the Primeng Inplace always show hidden info after the click event, but I want to check if the user have tried to solve the question already, if one hadn’t, clicking won’t trigger Inplace to show the info.The HTML code is showing below:

<p-carousel [value]="words2Learn" [numVisible]="1" [numScroll]="1" [showNavigators]="false"
                [showIndicators]="false" [page]="wordIdx" itemStyle="width:100%">
                <ng-template let-word pTemplate="item">
                    <p-fieldset legend={{word.wordDto.bookNameCh}}
                        class="card flex flex-column md:flex-row md:align-items-center justify-content-around">
                        <div>
                            <p class="mb-1 font-black text-6xl">{{ word.wordDto.wordName }}</p>
                        </div>
                    </p-fieldset>
                    <p-fieldset legend="Details">
                        <p-accordion [activeIndex]="[0,1,2,3,4,5]" [multiple]="true">
                            <p-accordionTab *ngIf="word.wordDto.remMethods.length > 0" [disabled]=" detailsDisabled"
                                header="Remember Method">
                                <p-inplace #rem [active]="showRem" [attr.wordId]="word.wordDto.id"
                                    (onActivate)="showDetails($event, 'rem',word.wordDto.id)">
                                    <ng-template pTemplate="display">
                                        <i class="pi pi-lock flex justify-content-center" style="font-size: 3rem"></i>
                                    </ng-template>
                                    <ng-template pTemplate="content">
                                        <span
                                            class="font-bold flex justify-content-center">{{word.wordDto.remMethods[0].method}}</span>
                                    </ng-template>
                                </p-inplace>
                            </p-accordionTab>
                        </p-accordion>
                    </p-fieldset>
</p-carousel>

I know activate() and deactivate() methods of Inplace can show and hide, so I’d like to manually decide whether or not to show the info according to a condition, while the condition here is not important, say it is a simple boolean variable that can be assigned by some logic. I tried to use (onActivate) hook to capture the click event, passing a function showDetails($event, 'sen', word.wordDto.id) to it. Where word.wordDto.id is also the custom attribut [attr.wordId] for the current p-inplace, so I can use this to locate which p-inplace is been clicking. Inside showDetails(), I tried to find the current p-inplace by using elementRef and @ViewChildern and attribute [attr.wordId], though I can access the right p-inplace, but the problem is I can’t find a way to evoke the activate(event) and deactivate(event) function.

The .ts code is shown below:

export class DashboardComponent implements OnInit, OnDestroy {

    @ViewChild('usPhoneUrl') usPhone!: HTMLAudioElement
    @ViewChildren('rem', { read: ElementRef }) rem!: QueryList<ElementRef>

    showDetails(event: Event, component: string, wordId: string) {
        if (!this.haveTried) {
            this.messageService.add({ severity: 'warn', summary: 'Warn', detail: "Try first!" });
            switch (component) {
                case 'rem':
                   (this.rem.toArray()
                        .filter(x => x.nativeElement.getAttribute('wordId') === wordId)[0]
                        .nativeElement as Inplace).deactivate(event);
                    break;
                ......
                default:
                    break;
            }
        }

Note this.haveTried is the condition to evoke activate() or deactivate().

The error from browser is:

TypeError: this.cog.toArray(...).filter(...)[0].nativeElement.deactivate is not a function

It seems the as Inplace didn’t do the convert work. When I tried to console.log(XXX.nativeElement as Inplace), I still got html element rather than Inplace instance, I guess that’s why I can’t access the method.

I also tried @ViewChildren('rem', { read: Inplace }) rem!: QueryList<Inplace>, in this way I can get an array of Inplace instances and for each one to call activate() and deactivate(), but how can I filter ther right p-inplace html element then?

I have tried all I can do, any one help!

BTW I’m using "primeng": "17.18" and

"@angular/animations": "^17.0.5",
        "@angular/cdk": "^17.0.2",
        "@angular/common": "^17.0.5",
        "@angular/compiler": "^17.0.5",
        "@angular/core": "^17.0.5",
        "@angular/forms": "^17.0.5",
        "@angular/platform-browser": "^17.0.5",
        "@angular/platform-browser-dynamic": "^17.0.5",
        "@angular/router": "^17.0.5",

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật