"version": "4.1.0",
"adonis-version": "4.1.0",
"@adonisjs/ace": "^5.0.2",
"@adonisjs/antl": "^2.0.6",
"@adonisjs/auth": "^3.0.5",
"@adonisjs/bodyparser": "^2.0.3",
"@adonisjs/cors": "^1.0.6",
"@adonisjs/fold": "^4.0.8",
"@adonisjs/framework": "^5.0.7",
"@adonisjs/ignitor": "^2.0.6",
"@adonisjs/lucid": "^5.0.4",
"@adonisjs/mail": "^3.0.8",
"@adonisjs/session": "^1.0.25",
"@adonisjs/shield": "^1.0.6",
"@adonisjs/validator": "^5.0.3",
node.js: v10.8.0
npm: 6.4.0
controller:
return view.render('pages.confirmation',{status:0})
or
return view.render('pages.confirmation',{status:1})
view:
{{status}}
@if(status===1)
do sth
@elseif(status===0)
do sth
@endif
The view evaluates the value as empty string / null / undefined and prints nothing to screen when status is 0 . If i set status to other than 0, it prints the number to screen properly. Is this a bug? If it is not, it should also print 0 (integer).. I am not sure the problem is about the data sending mechanism or printing data to screen mechanism.
Thank you for your helps.
Yes, seems like a bug. As a workaround, you can say.
view.render('pages.confirmation',{status: String(0)})
and use it follows inside the view
@elseif(status === '0')
Okey, thank you for confirmation. There are lots of workaround to resolve this issue. No problem for me but I just want to inform you. 馃憤
Late to the game, but have seen this is still open.
I don't think this is actually a bug on AdonisJS side, as after briefly looking at the code,
view.render(...) is just a proxy for the same function on the Edge template engine.
I am almost done with the newer version of Edge https://github.com/edge-js/edge/tree/develop. Just need some time to work on the docs and get it out
Fixed and released in the new version of edge and is compatible with v5
Most helpful comment
Yes, seems like a bug. As a workaround, you can say.
and use it follows inside the view