Edit Page

sails.renderView()

This feature is still experimental.
#

This method is still under development, and its interface and/or behavior could change at any time.

Compile a view into an HTML template.

sails.renderView(pathToView, templateData);

Usage

#
  Argument Type Details
1 pathToView String The path to the view that will be compiled into HTML.
2 templateData Dictionary? The dynamic data to pass into the view.

Example

#

To compile an HTML template with a customized greeting for the recipient:

var htmlEmailContents = await sails.renderView('emails/signup-welcome', {
  fullName: inputs.fullName,
  // Don't include the Sails app's default layout in the rendered template.
  layout: false
});

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference