Component#hasBlockParams

hasBlockParamspublic

Defined in packages/ember-htmlbars/lib/component.js:258
Available since 1.13.0

Returns true when the component was invoked with a block parameter supplied.

Example (hasBlockParams will be false):

{{! templates/application.hbs }}

{{#foo-bar}}
  No block parameter.
{{/foo-bar}}

{{! templates/components/foo-bar.hbs }}
{{#if hasBlockParams}}
  This will not be printed, because no block was provided
  {{yield this}}
{{/if}}

Example (hasBlockParams will be true):

{{! templates/application.hbs }}

{{#foo-bar as |foo|}}
  Hi!
{{/foo-bar}}

{{! templates/components/foo-bar.hbs }}
{{#if hasBlockParams}}
  This will be printed because a block was provided
  {{yield this}}
{{/if}}

Returns:

Boolean
doc_EmberJs
2016-11-30 16:48:48
Comments
Leave a Comment

Please login to continue.