0

I try to figure out the situation with twig and angular. When I use == give me false or false when I use "is same as".

The dump after set give me "February"

{% set month = "{[ calendar.month ]}" %}
{{ dump(month) }}

{% if (month == 'February') %}
 true
{% else %}
false
{% endif %}

{% if month is same as ('February') %}
 true
{% else %}
 false
{% endif %}

Is it any solution or I have to choice something different.

Thanks

Dawid Zbiński
  • 5,521
  • 8
  • 43
  • 70
krasiit
  • 31
  • 1
  • 4

1 Answers1

1

You cannot simply pass variable from angular (JavaScript) code to the code in PHP. PHP code runs at the server side, and it doesn't know anything about what is going on on the client side. Which means variable month contains exactly this text: {[ calendar.month ]} and this is not equals to February.

Here is a more detailed explaination: What is the difference between client-side and server-side programming?

vstelmakh
  • 742
  • 1
  • 11
  • 19