is it possible to use the countRitiri
output property inside its parent <mat-tab>
without to call a function in the current component updateCountRitiri
that updates the variable countRitiri
that consequently is used in the <mat-tab>
template
this is my actual situation:
<mat-tab [label]="'Total count: (' countRitiri ')'" >
<ant-ritiri-compact (countRitiri)="updateCountRitiri($event)"></ant-ritiri-compact>
</mat-tab>
and in the component
updateCountRitiri(value)
{
this.countRitiri = value;
}
maybe using a template variable... or some similar trick
i'd like to do something similar
//pseudocode
<mat-tab #mytabvariable [label]="'Total count: (' countRitiri ')'" >
<ant-ritiri-compact (countRitiri)="($event) => { #mytabvariable.label = $event }"></ant-ritiri-compact>
</mat-tab>
CodePudding user response:
If countRitiri
is not declared private
or protected
, then yes you can use it directly inside its component's template like so
<mat-tab [hidden]="countRitiri == 0" [label]="'Total count: (' countRitiri ')'" >
<ant-ritiri-compact (countRitiri)="countRitiri = $event"></ant-ritiri-compact>
</mat-tab>