Is it possible to call a controller method to render a template within a template? Or is that totally the wrong aproach?
In the div container there is only a sting displayed but not the redered html from my productTable template.
The displayed string inside the <div class="products">
:
SimpleResult(200, Map(Content-Type -> text/html; charset=utf-8))
Template:
@categories.map {cat =>
<div>some html</div>
<div class="products">@controller.Products.getByCatergoyId(cat.id)</div>
}
Controller:
public static Result getByCatergoyId(Long catId) {
List<Product> products = Product.find.where().eq("category.id", catId).findList();
return ok(views.html.display.productTable.render(products));
}