Answer the question
In order to leave comments, you need to log in
How to display the size of the edited *ngFor array in another (previous) html block?
There is a component template:
<div >
<!-- Загружаем список ошибок -->
<div *ngFor="let error of errors">
<div>
<h4>{{error.name}}</h4>
<p>(кол-во: {{Здесь нужно отобразить размер массива items, полученный ниже}})</p>
</div>
<!-- Загружаем для каждой ошибки свой список данных отсортированный пайпом -->
<div>
<div *ngFor="let item of items | sortItemsByError:error; let l = count">
<a [routerLink]="['/items/',item.id]">{{item.name}}</a>
</div>
</div>
</div>
</div>
Answer the question
In order to leave comments, you need to log in
{{ items.length }}
don't you?
Generally speaking, you can use the template context to pass a value into a template.
like this
https://stackblitz.com/edit/angular-xkuwzk
you can also use a crutch in the form of a let (or var) directive (or ngIf)
sketched: https://stackblitz.com/edit/angular-mwqwws
but better just upon receipt of data, process them and save them in a separate variable, and already refer to it in the template.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question