I'm trying to dynamically build a number of datepickers from Angular Material.
The sample code given in Angular Material is like this:
<input [matDatepicker] = "myDatepicker">
<mat-datepicker-toggle [for] = "myDatepicker"></mat-datepicker-toggle>
<mat-datepicker #myDatepicker></mat-datepicker>
Now my issue is that I want to wrap this whole code block in an *ngFor
and let it repeat a number of times. Therefore instead of #myDatepicker
I name it #myDatepicker{{i}}
where i
is the index of the *ngFor
loop. My issue is now how do I put that index i
in the [for] = "myDatepicker"
part?
I have tried [for] = "myDatepicker{{i}}"
which gives an error:
Template parse errors: Parser Error: Got interpolation({{}}) where expression was expected.
I have also tried for = "myDatepicker{{i}}"
but that doesn't seem to work either even though no error.