« All deprecation guides

Deprecation Guide for Using the {{with}} Helper with the controller option

Another option deprecated due to the de-emphasis of controllers is the controller option used with the {{with}} helper. In prior versions it was possible to specify a controller when using {{with}}, which would use an instance of the specified controller as the context within the block.

{{#with item.posts controller="myposts"}}
  {{!- numPosts fetched from the controller instance "myposts" }}
  There are {{numPosts}} posts.
{{with}

Similar to the deprecated {{each}} helper controller options , this approach triggers less performant compatibility code and is deprecated in favor of using local properties or components.

Using local properties

{{#with item.posts as |myPosts|}}
  There are {{myPosts.length}} posts.
{{with}}

Using a component

{{! prints the number of posts (if available) }}
{{post-status posts=item.posts}}