adobe / htl-spec

HTML Template Language Specification
Apache License 2.0
280 stars 146 forks source link

Support of passing parameters to Sling Model methods #86

Open mkovacek opened 4 years ago

mkovacek commented 4 years ago

Would be nice if there is possible to call Sling model method which takes parameters.

Example:

Sling model: public String getMethod(String param1, String param2){ return param1 + param2; }

Htl:

${model.method(value1, value2)} or ${model.method @ value1, value2 } or ${model.method @ param1=value1, param2=value2 }

rob-heaney-itg commented 1 year ago

I would also like to see this feature 👍

@ADOBE: Has there been any discussion about the potential to add support for this? (or has anything been added since May 2020 that can provide an equivalent to this?)

vladbailescu commented 1 year ago

@mkovacek , @rob-heaney-itg , not being able to call methods with parameters is actually intended, not something that was overlooked. The reason behind being that the spec designers wanted to ensure business logic is decoupled from the presentation layer.

CC: @gabrielwalt , @raducotescu