Git Product home page Git Product logo

Comments (4)

thetutlage avatar thetutlage commented on May 27, 2024

Shouldn't you simply check views docs to see how to render views? https://preview.adonisjs.com/guides/views/introduction#usage

from legacy-docs.

alanondra avatar alanondra commented on May 27, 2024

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?

from legacy-docs.

thetutlage avatar thetutlage commented on May 27, 2024

Well, not sure what exactly you are upto.

Copy/paste the following code in routes file and it will work without any modifications

20200816_180253.jpg

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

from legacy-docs.

alanondra avatar alanondra commented on May 27, 2024

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.

from legacy-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.