'How to concat string in Ionic 4 with the template?
I need to contact the name and surname in my Ionic 4 Full Starter kit template:
<app-text-shell [data]="customer?.surname + customer?.name"></app-text-shell>
Unfortunately there is not the space between them; how Can I do? If I create a function in customer link getNameAndSurname() there is a message error.
Solution 1:[1]
The above answer did work for me in Ionic 4 with little enhancement. Replacing "" with '' inside the data property.
<app-text-shell [data]="details?.min_salary+' '+details?.min_salary"></app-text-shell>
Solution 2:[2]
When 'customer' is defined but contains only empty properties, then this will end up showing 'undefined undefined', instead of the app shell (at least for me), because that added space does make it non-empty. So my solution is instead of this:
<app-text-shell [data]="details?.min_salary+' '+details?.min_salary"></app-text-shell>
Use this:
<app-text-shell [data]="details.min_salary? details.min_salary+' '+details.min_salary : ''"></app-text-shell>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Vishal Kumar |
| Solution 2 | Lippai Zoltan |
