1. Slot
  2. Partials

The EjsViews are HTML-Pages with embedded Javascript-tags.

To make a specific view called MyView known to the application you have to put a file called MyView.ejs into myapp/views or the views-folder of a plugin.

Now you are able to use context.view_name = 'MyView' in any controller.

There are two ways to define embedded Javascript.

For instance executing this ejs-code:

The result of 2+5 = <%= (2+5) %>.

would result in:

The result of 2+5 = 7.

By using the powerful <% ... %> construct, even this is possible:

<ul>
<%
for (var i=0; i<10; i++) {
%>
    <li>This is the #<%= i %> line</li>
<%
}
%>
</ul>

Comments