Templates.helpers.partial()

partial (partialName) public

Defined in packages/ember-htmlbars/lib/keywords/partial.js:9

The partial helper renders another template without changing the template context:

{{foo}}
{{partial "nav"}}

The above example template will render a template named "-nav", which has the same context as the parent template it's rendered into, so if the "-nav" template also referenced {{foo}}, it would print the same thing as the {{foo}} in the above example.

If a "-nav" template isn't found, the partial helper will fall back to a template named "nav".

Bound template names

The parameter supplied to partial can also be a path to a property containing a template name, e.g.:

{{partial someTemplateName}}

The above example will look up the value of someTemplateName on the template context (e.g. a controller) and use that value as the name of the template to render. If the resolved value is falsy, nothing will be rendered. If someTemplateName changes, the partial will be re-rendered using the new template name.

Parameters:

partialName String
The name of the template to render minus the leading underscore.
doc_EmberJs
2016-11-30 16:53:36
Comments
Leave a Comment

Please login to continue.