Reputation: 1836
I use FOSJsRoutingBundle to bring my routes to JavaScript. My controller annotation:
/*
* @Method("GET")
* @Route("/search/{searchterm}", name="_api_player_search", options={"expose"=true})
*/
My JavaScript:
console.log(Routing.generate('_api_player_search', {searchterm: 'aaron', limit: 5}, true));
The output in firebug console:
undefined://undefinedundefined/api/player/search/aaron?limit=5
Testing on a local xampp server, Symfony v 2.4.2, FOSJsRoutingBundle in is actual version from 18. Feb 2014.
You see the problem? What have i done wrong?
Upvotes: 0
Views: 335
Reputation: 1119
Try to rename your route name to somthing like
/*
* @Route("/search/{searchterm}",
name="apiPlayerSearch",
options={"expose"=true},
methods={"GET"}
)
*/
Then run
php app/console fos:js-routing:dump
This could work as i had a similar problem.
Upvotes: 1