I have a template to be recursive, something similar to below:
<ng-container *ngTemplateOutlet="testTemplate; context: {$implicit:jsonObj1}"> </ng-container> <ng-template #testTemplate let-Json1> </ng-template>
It works fine, I send jsonObj1 using $implicit, but I would like to send two parameters to , if I try:
context: {$implicit:jsonObj1, $implicit:jsonObj2}
and try to access using
<ng-template #filterTemplate let-Json1 let-json2> </ng-template>
It doesn't work, let me know, how to pass two parameters.
You don't need to use $implicit
You can use
1:
context: {$implicit:jsonObj1, b:jsonObj2}
with
<ng-template #filterTemplate let-json1 let-json2="b"> <div>{{json1}}</div></div>{{json2}}</div> </ng-template>
or 2:
context: {$implicit: {a: jsonObj1, b:jsonObj2}}
with
<ng-template #filterTemplate let-json1> <div>{{json1.a}}</div></div>{{json1.b}}</div> </ng-template>
or 3:
context: {a:jsonObj1, b:jsonObj2}
with
<ng-template #filterTemplate let-json1="a" let-json2="b"> <div>{{json1}}</div></div>{{json2}}</div> </ng-template>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With