Sunday, 11 June 2017

How to add default value for html from json passed from server in Pug?

Not a duplicate of How to add default value for html <textarea>? but very similar, I just want to do that in Pug.

I want to set a default value for my html <textarea> that is populated from data passed by to me by my router in Node.js.

I've tried
textarea {JSON.parse(fromServer.myJson).author}
textarea
textarea JSON.parse(fromServer.myJson).author

All I get are text areas populated with my code instead of the values that I'm passing in that code.

fromServer.myJson is a really hacked together piece of data, it's a String that was json inside the json object fromServer that's being passed from MySQL. I face the same problem if I use fromSever.title which is a more sane object.



via Glen Pierce

No comments:

Post a Comment