Outputting field's invalidMessage in viewmodel


Hi there, I’m enjoying making use of viewmodel validation for a form and the validation is mostly working nicely, however I can’t seem to find a reference to outputting a particular field’s invalid message, the docs only reference all the invalid messages in a loop. Am assuming this is possible as I can call myField.invalid in my template and it works correctly.

Have tried for example:

span.block.mt-1.text-red($b="if: firstName.invalid") {{ firstName.invalidMessage }}

Answering my own question here, it appears binding the value to text works whereas just outputting between {{ }} didn’t so (in Jade/Pug):

span.text-red($b="if: firstName.invalid, text: firstName.message")

message shows the valid/invalid message depending on validity, invalidMessage would show that message even if the input is in fact valid