How to escape a key/braces on Blade?

Asked

Viewed 166 times

1

In Blade, the key (or key) characters are intended to add the purpose of printing the content. It is complicated to a echo.

But I was wondering if I really needed to display a piece of content, containing exactly the value of the keys, which I could do?

For example, if I needed to display the content below, how could I "escape" those characters on Blade?

{{ $variavel }} Isso vai ser compilado.

{{ Essa parte tem que ser exibida literalmente no HTML }}
  • 1

    What is the problem with the question to win -1? Could you give details on what can be improved?

  • You are welcome, I misunderstood what you wanted. Comment deleted

  • 3

    I didn’t understand why they were negative.... + 1 to balance..

  • Neither do I, it seems to me to be a question that can arise frequently

1 answer

4


Add a @ to write keys (Curly Brackets) literally

@{{ $var }}

will display literally

@{{ $var }}

If I’m not mistaken, in Laravel smaller than 5.1, I didn’t have this feature so we did it with Htmlentities. But in tests performed by the AP itself, it was found that the feature is available in version 4.2 of Laravel.

  • This will be a good solution to not keep configuring key interpolation tags in Angular JS. But in previous versions would not have much solution.

  • I tested on Laravel 4.2 and it also worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.