lundi 31 octobre 2016

Angular 2: if attr.title in html == array in component

<div class="kalender">
    <table *ngIf="datoer">
        <tr>
            <td *ngFor="let cell of ukeEn()" 
                [attr.title]="cell.id"></td>
                </div>
        </tr>
    </table>
</div>

I would like to check if attr.title (or cell.id) == any of the elements in an array called 'datoer', which is defined in my component. So I need to check the attr.title up against every value in the 'datoer' array. Then I want to add an element (for ex. 'div' or 'p') in the 'td' if this condition is true.

Is this possible? If you need more code samle to understand my problem, just ask.

Aucun commentaire:

Enregistrer un commentaire