Last active
May 17, 2020 16:27
-
-
Save tarlepp/f3983930c25a39f56d2cea33e0ffb74c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends "base.html.twig" %} | |
| {% block javascripts %} | |
| <pre>{{ json }}</pre> | |
| <pre>{{ json | raw }}</pre> | |
| <script> | |
| var foo = {{ json | raw }} | |
| console.log(foo); | |
| alert(foo); | |
| </script> | |
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App\Controller; | |
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
| use Symfony\Component\Routing\Annotation\Route; | |
| class DefaultController extends AbstractController | |
| { | |
| /** | |
| * @Route("/", name="default") | |
| */ | |
| public function index() | |
| { | |
| return $this->render('default.twig', ['json' => json_encode(['foo' => 'bar', 'bar' => 'foo'])]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment