错误:
An exception has been thrown during the rendering of a template
"You have requested a non-existent service "C". Did you mean one of
these: "Symfony\Bundle\FrameworkBundle\Controller\RedirectController",
"Symfony\Bundle\FrameworkBundle\Controller\TemplateController
Run Code Online (Sandbox Code Playgroud)
如何在symfony 4中打开FOSJsRoutingBundle?
bundles.php:
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true]
Run Code Online (Sandbox Code Playgroud)
routes.yaml:
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
Run Code Online (Sandbox Code Playgroud)
layout.html.twig:
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', { callback: 'fos.Router.setData' }) }}"></script>
Run Code Online (Sandbox Code Playgroud)