0

Below is how i am using with Mustache.If source is there i am showing {{#flag_sour}} data, if destination is there i am showing {{#flag_dest}} data.

{{#onwardfl}}                            
{{#flag_sour}}                           
<div class="col-xs-12 flightbooking noleftpadding">
<div class="col-xs-12">
<p  style="color:#165391;">  this is not a direct flight </p>
</div>

</div>
{{/flag_sour}}
{{#flag_dest}}                           
<div class="col-xs-12 flightbooking noleftpadding">
<div class="col-xs-12">
<p style="color:#165391;">  this is not a direct flight </p>
</div>

</div>
{{/flag_dest}}
{{/onwardfl}}

if {{#flag_sour}} and {{#flag_dest}} are both there i want to show only one message this is not a direct flight. How can i do this with mustache.

Rohit Arora
  • 2,246
  • 2
  • 24
  • 40
siva
  • 7
  • 1
  • 8
  • 1
    @unixarmy gave the correct answer, it is not possible. I guess the easiest way would to achieve the desired functionality would be to create new `flag_direct` value in the data (thus not computed by Mustache) – Werner Jun 18 '15 at 08:10

1 Answers1

1

Mustache is "logic-less" template engine, so if you are using Model-view-controller architecture, it would be better to solve your problem in your controller.

That's the idea of logicless templating.

Kristian Vitozev
  • 5,791
  • 6
  • 36
  • 56