From 38450198a89f70a19a3a75fc920b710311bfc534 Mon Sep 17 00:00:00 2001 From: Sergio Arbeo Date: Fri, 18 Sep 2015 23:10:05 +0200 Subject: [PATCH] Add documentation for closure component --- .../ember-htmlbars/lib/keywords/component.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/ember-htmlbars/lib/keywords/component.js b/packages/ember-htmlbars/lib/keywords/component.js index be96e80790d..ab0b2743cf1 100644 --- a/packages/ember-htmlbars/lib/keywords/component.js +++ b/packages/ember-htmlbars/lib/keywords/component.js @@ -49,6 +49,29 @@ import isEnabled from 'ember-metal/features'; {{live-updating-chart}} ``` + ## Nested Usage + + The `component` helper can be used to package a component path with initial attrs. + The included attrs can then be merged during the final invocation. + + For example, given a `person-form` component with the following template: + + ```handlebars + {{yield (hash + nameInput=(component "input" value=model.name placeholder="First Name"))}} + ``` + + The following snippet: + + ``` + {{#person-form as |form|}} + {{component form.nameInput placeholder="Username"}} + {{/person-form}} + ``` + + would output an input whose value is already bound to `model.name` and `placeholder` + is "Username". + @method component @since 1.11.0 @for Ember.Templates.helpers