How do I access request parameters in kademi templates?

39 views Asked by At

I've been developing a website with Kademi and i'm trying to implement a date range search, I've got the date range adding parameters to the URL

?startDate=02/05/15&endDate=12/12/2015

But I don't know how to retrieve these values in kademi templates. How do I do this?

1

There are 1 answers

0
brad On BEST ANSWER

According to the Kademi templating guide[1], there is a request object in context for template rendering. The request object has a params property which is a map of parameter names and values.

So you can do this:

 $request.params.startDate

Note that this returns a string. If you want to convert it to a Date object use the formatter:

$formatter.toDate( $request.params.startDate )

[1] http://docs.kademi.co/ref/guides/1-templating-overview.html