как значение присваивается эталонной переменной в угловых 2? - PullRequest
0 голосов
/ 14 мая 2018
<ng-container  *ngFor="let item of users">
                        <td  *ngIf="item.method == update.business_type">{{item.id}}</td>
</ng-container>

как значение item.id назначается для ссылки. Я пытался, но она не работает

1 Ответ

0 голосов
/ 14 мая 2018

Вам нужно будет создать директиву * ngLet или * ngFor по следующей ссылке:

https://medium.com/@AustinMatherne/angular-let-directive-a168d4248138

Этоспособ объявления переменных в шаблонах после создания директив:

<ng-container  *ngFor="let item of users">
    <ng-container *ngLet="item.id as ref_var">
        <td  *ngIf="item.method == update.business_type">{{ref_var}}</td>
    </ng-container>
</ng-container>

Это также возможно с использованием директивы * ngVar:

<ng-container  *ngFor="let item of users">
    <ng-container *ngVar="item.id as ref_var">
        <td  *ngIf="item.method == update.business_type">{{ref_var}}</td>
    </ng-container>
</ng-container>
...