title: Angular 6: Is it possible to pass a function as parameter?
body: <p>I have a modal-form template that I would like to create with some shared functionalities. Mainly two buttons at the bottom: one to cancel and one to run any function (essentially it could <code>save()</code>, <code>next()</code>, etc.).</p>
  <p>I know you can interpolate and bind data, but functions?</p>
  <p>Is it possible to pass a function, specifically for a click handler?</p>
  <p>MODAL TEMPLATE:</p>
  <pre><code>//modal-template.html
  
      &lt;div class=&quot;modal-footer&quot;&gt;
        &lt;button type=&quot;button&quot; class=&quot;btn btn-outline-dark&quot; (click)=&quot;{{someFunction()}}&quot;&gt;Save&lt;/button&gt;
        &lt;button type=&quot;button&quot; class=&quot;btn btn-outline-dark&quot; (click)=&quot;activeModal.close('Close click')&quot;&gt;Cancel&lt;/button&gt;
      &lt;/div&gt;
  
  
  //modal-template.ts
  
  import { Component, Input, OnInit } from '@angular/core';
  import {NgbModal, NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
  
  @Component({
    selector: 'app-modal-template',
    templateUrl: './modal-template.component.html',
    styleUrls: ['./modal-template.component.css']
  })
  export class ModalTemplateComponent implements OnInit {
  
    constructor(public activeModal: NgbActiveModal) { }
  
    ngOnInit() {
    }
  
  }
  </code></pre>
  <p>MODAL-COMPONENT:</p>
  <pre><code>//custom-modal.component.html
  
  &lt;app-modal-template (click)=&quot;someFunction()&quot;&gt;
    &lt;app-custom-modal&gt;&lt;/app-custom-modal&gt;
  &lt;/app-modal-template&gt;
  </code></pre>