I have a field.scala.html that should take a control as input and render it.
Right now I do like this:
@field("shop", "name", true) { (modelName, fieldName, required) =>
@textInput(modelName, fieldName, required)
}
But I would like to do it like this: @field("shop", "name", true)(textInput)
I see 2 ways it could be done but not sure if it's possible:
- Somehow via reflection call the textInput.apply with appropriate parameters.
- Make textInput implement some trait and field would require an instance of this particular trait (more type safe)
Maybe there is a better way?