Topic: Mdb Tooltip with ng Template
Kloew free asked 4 years ago
Expected behavior
Passing parameters/variables to a mdbtooltip template
Actual behavior
trying to pass a parameter via context to the tooltip template results ina compilation error
Resources (screenshots, code snippets etc.)
I am trying to pass a parameter (array of errors) to a mdbtooltip template but it results in the following compilation error:
Failed to compile.
Template parse errors: Parser Error: Binding expression cannot contain chained expression at column 26 in [validationErrorTemplate; context: adamsId.errors]
Here is a code snippet which explains what i want to achieve:
<input [(ngModel)]="model.adamsId" #adamsId="ngModel"
id="inputAdamsId" name="adamsId"
mdbInput type="text" class="form-control" />
<label for="inputAdamsId">Adams-ID</label>
<mdb-error class="custom-error-message" *ngIf="adamsId.invalid" [mdbTooltip]="validationErrorTemplate; context: adamsId.errors" placement="bottom">
{{adamsId.errors['adamsId0']}}
</mdb-error>
<ng-template #validationErrorTemplate let-validationErrors="errors">
<span *ngfor="let error of errors| keyvalue">
{{error.value}}
</span>
</ng-template>
Can you explain how I can add parameters to a ng-tempalte?
Thanks in advance.
Arkadiusz Idzikowski staff answered 4 years ago
Currently it's not possible to add a context for tooltip/popover template, but we will add this feature to our nice-to-have list.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: 9.0.1
- Device: pc
- Browser: google chrome
- OS: win10
- Provided sample code: No
- Provided link: No