legacy-docs
legacy-docs copied to clipboard
Missing rendering Views from Controller documentation
I had to go to Form Submissions / Reading Form Data to see how to render Views from Controllers. It should probably be included in both View and Controller documentation.
Shouldn't you simply check views docs to see how to render views? https://preview.adonisjs.com/guides/views/introduction#usage
Can you highlight the part where it says view
needs to be imported from HttpContextContract
in the Controller method signature? Perhaps where HttpContextContract
needs to be imported from?
Well, not sure what exactly you are upto.
Copy/paste the following code in routes file and it will work without any modifications
When you create a new controller using node ace make:controller
command. It does import the HttpContextContract
for you.
So just like the route callback, you use the view inside a controller. Not sure if that needs to be told explicitly.
Docs have to balance over writing too
There is no indication on the page that you have to create this signature to use it with Controllers, merely passing { view }
throws an exception:
public async index({ view } : HttpContextContract)
I'm telling you as a user that the documentation was not clear and there was no way to intuit that this was necessary, otherwise this ticket wouldn't have been created.