Search code examples
ionic-frameworkionic4

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

  • Simply Pass this way

    <app-text-shell [data]="customer?.surname +" "+ customer?.name"></app-text-shell>
    

    add space

    +" "+
    

    or

    customer = { surname: "weerasinghe", name: "chanaka" };
    

    .html

    <app-text-shell [data]="customer"></app-text-shell>
    

    Access data

     this.data.surname