× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Aliasing models for verbosity

Ilya Radchenko
Apr 23, 2015
<p>Alias your model to something more verbose, e.g. if your model is a user, do `user: alias(‘model’)`. Since routable components will have explicit attributes set, this will prepare your codebase for that transition.</p> <p> </p> <p>This will allow you to be more clear in your templates and component code. So instead of doing something like:</p> <p> </p> <pre><code class="language-html">{{#each model as |user|}} {{!-- use user here --}} {{/each}}</code></pre> <p> </p> <p>You can be clear and say:</p> <pre><code class="language-html">{{#each users as |user|}} {{!-- use user here --}} {{/each}}</code></pre> <p> </p>
comments powered by Disqus