Angular 2 Dart: Template syntax - how to concatenate strings? Angular 2 Dart: Template syntax - how to concatenate strings? dart dart

Angular 2 Dart: Template syntax - how to concatenate strings?


The best way is to declare a getter inside your Component controller that does the concatenation for you, you will get dart syntax support and the html template will looks cleaner.

String get myConcatenation => "${order.pickupPlace.name}${order.pickupPlace.email}";<div id="abc">   {{myConcatenation}}</div>


The last two examples can be made to work easily:

<div id="abc">  <br/>{{order.pickupPlace.email}}</div>

And:

<div id="abc">  {{order.pickupPlace.name}} {{order.pickupPlace.email}}</div>

Angular handles this pretty well. If you need some more complicated logic you can move it to the Dart code (but you cannot use HTML there easily).

If you find creating lot of weird logic consider creating more smaller components that can handle this for you.