Read Spring ModelAndView objects in Pug -


my front-end application uses pug generate index page.

being vue.js application, can served java (production purpose) or node (develop purpose)

develop

variables in index.pug injected running command:

pug -p -s -o ./variables.js -o ./ index.pug 

variables.js like:

variables = {   value: 'something' } 

variables inside index.pug can readed like:

if variables.value == 'something'   //show tags ecc... 

all working fine.

production

to render index.pug server side use jade4j

in index controller like:

@requestmapping(value = "/index.htm") public modelandview indexview(...) {    ... other code here...    modelandview mav = new modelandview("index");    mav.addobject("value", "something");    return mav; } 

but value can readed in script. tag syntax '#{value}' in example:

script.    console.log('#{value}') // prints "something" 

how can read value in develop scenario above?

this has given me answer.

it pretty simple after all... i've never tried cause thought dummy.

just use #{value} without '' inside "pug code", otherwise.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -