亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

組件上的@input 給出錯誤:類型上不存在屬性“showingSingle”

組件上的@input 給出錯誤:類型上不存在屬性“showingSingle”

慕桂英546537 2021-10-21 14:13:28
所以我有一個 angular 8 應用程序。我在組件 DossierCorrespondenceComponent 中有這個:  @Input() showingSingle = false;這樣我就可以在其他組件(DossierCorrespondenceListComponent)中使用它。但如果我這樣做:<div *ngIf="!showingSingle && correspondenceEntries && correspondenceEntries.length > 0;">然后我會得到這個錯誤:Property 'showingSingle' does not exist on type 'DossierCorrespondenceListComponent'.那么如何解決這個問題呢?
查看完整描述

1 回答

?
慕姐8265434

TA貢獻1813條經驗 獲得超2個贊

可以看到里面說的很清楚了showingSingle不存在DossierCorrespondenceListComponent,需要在里面聲明DossierCorrespondenceListComponent才能使用。


如果可以的話,告訴我們你的代碼DossierCorrespondenceListComponent,并DossierCorrespondenceComponent看到你想達到什么是更好的。


您可以查看 Angular Input 的文檔以獲取更多關于如何操作Angular Input 的信息


更新 1


簡而言之:DCLC =>DossierCorrespondenceListComponent和 DCC 為DossierCorrespondenceComponent


我看到您要顯示 DCC 組件的列表,該屬性showingSingle需要繞過 DCLC 的值。


在你的ngFor循環中,showingSingle像這樣添加到循環中


<div *ngFor="let c of list">

  <DCC [showingSingle]="c"></DCC>

</div>

旁注:您應該使用英語而不是法語作為組件的名稱,并且您正在與德國人合作


查看完整回答
反對 回復 2021-10-21
  • 1 回答
  • 0 關注
  • 176 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號