How to set default parameter for @Input in Angular2?
<p>Say I have a component that will display a <code>name</code> property, so it roughly goes like this:</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import {Component, Input} from 'angular2/core';

@Component({
  selector: 'demo',
  template: `&lt;div&gt;{{name}}&lt;/div&gt;`,
  styles: [``],
})
export class Demo {
  @Input() name: string;
}</code></pre>
</div>
</div>
</p>

<p>The problem is, how could I display <code>[noname]</code> when someone using this component but not passing any <code>name</code> property?</p>

<p>The only solution comes to mind is using logic operator inside template like <code>{{ name || '[noname]' }}</code>.</p>