The route configuration for the epi/routes helper is generated from the module.config settings. You can probably achieve what you want by adding the following the module.config in the site.
<module routeBasePath="~/">
<routes>
<route url="{controller}/{action}/{id}" />
</routes>
</module>
and the getting the route path using
routes.getActionPath({
moduleArea: "App",
controller: DynamicImages",
action: "Images"
});
Thank you very much for the aswer. It helped.
But if I use the parameter moduleArea: "App" , I get the url "MySite/DynamicImages/Images?moduleArea=App"
How to setup the route without the moduleArea = App ?
How to get the list of the available moduleArea?
Please, help.
P.S. I used the epi.routes.getActionPath({controller: "DynamicImages",action: "Images"}, "{controller}/{action}"), returned the "DynamicImages/Images"
but how to return clear "MySite/DynamicImages/Images"?
Hmm, the getActionPath helper is primarily intended for resolving routes to the different modules, and therefore the module area is always a part of the route. And since the logic in the helper is quite simple, all parameters that can't be substituted in the path will be appended as query parameters.
For the available areas you can look at
epi.routes.registeredRoutes
Dear EPIServer Team,
please help.
I want to get the partial view in dojo component. The issue is with the request url.
When i try to use(DynamicImages is a controller and Images as an action)
$.post("DynamicImages/Images", { json: jsonData }, function (value) {
var fieldContainer = $('.imagesContainer');
the request is sent to incorrect url: http://localhost:83/DynamicImages/Images,
not to http://localhost:83/MySite/DynamicImages/Images.
I found epi.routes.getActionPath, but how to use these method to get the correct url?
How to setup parameters?
var url = ({
moduleArea: "CMS", // ????
controller: "DynamicImages",
action: "Images",
});
The result is /MySite/EPiServer/CMS/DynamicImages/Images
but I need /MySite/DynamicImages/Images
What should I use to generate correct url to the action?
Thank you inadvance.