title: Angular 2 templates: defining a callback
body: <p>I'll create a simplified example of my real world problem, so let's say i have a component that lists objects.</p>
  
  <p>It takes the input <code>@Input() objects: Object[]</code> and <code>@Input label: Function</code>, so that it can output markup for each of the <code>objects</code> having the return value of <code>label</code> for each of them.</p>
  
  <p>The <code>label</code> should be a function creating a string and depending on the object, so that the child component is as flexible as possible in how it presents each object.
  Like <code>id + title</code> or <code>"This is item " + number</code> or <code>"item " + title + " costs " + cost + "$"</code>...</p>
  
  <p>A practial <code>label</code> could be <code>e =&gt; e.id + ': ' + e.title</code> where <code>e</code> (the argument for <code>label</code> is the respective item of <code>objects</code>)</p>
  
  <p>Now I would like to use this component B within another component's template A without adding the <code>label</code> function to A's component class because this would clutter A's component class a lot. I'd like to define the <code>label</code> function in the template, e.g. with</p>
  
  <pre><code>&lt;my-selector [objects]="myObjects" [label]="e =&gt; e.id + ': ' + e.title"
  </code></pre>
  
  <p>But no matter which notation I try, angular seems to discourage this with errors like <code>Bindings cannot contain assignments</code> and the like...</p>
  
  <p>Question:
  Is this possible to achieve and if not, what is the best approach to solve this?</p>