An error occurs when i use to show flash message in view adonis js
@if(flashMessages.has('errors.title'))
<p> {{ flashMessages.get('errors.title') }} </p>
@endif
Cannot read properties of undefined (reading 'has')
flashMessage
is only available when rendering a page with ctx.view.render()
or ctx.view.renderAsync()
. Check where you render the page and make sure you're using the view
member of the request's HTTPContext
and not Adonis.js's View
class (note the capital V).