Question

I have a div which displays edit button on hover.
But I don't know how display a partial view representing an edit form in this div only instead of the show view.
I haven't no backbone or client-side js framework plugged in my sailsjs app, I didn't manage to understand how it works, not enough documentation about backbone or angular + sails for me.

Could you help me for rendering this partial view please ?

Thanks by advance,

Cyril

Was it helpful?

Solution

Sails uses ejs-locals in its view rendering code, so in your views you can do:

<%- partial ('foo.ejs') %> 

to render a partial located at /views/foo.ejs. All of your locals will be sent to the partial automatically.

One thing to note: partials are rendered synchronously, so they will block Sails from serving more requests until they're done loading. We're considering replacing the code for loading partials to make it asynchronous, but for now it's something to keep in mind while developing your app, especially if you anticipate a large number of connections.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top