title: Creating methods within a class method in Typescript - Angular 2
body: <p>In Angular 2 I'm using bootbox.js to create dialogs (alerts, confirmations). I'm trying to create a dialog service, but I'm not sure how to write the code in Typescript is such a way that would allow me to use my service methods the way I'm hoping to.</p>
  
  <p><strong>How I want to use my service:</strong></p>
  
  <pre><code>export class SomeComponent {
  
    constructor(private _dialog: DialogService){}
  
    showConfirm() {
      _dialog.confirm()
        .title('Some title')
        .message('Some message')
        .okBtn('Sounds Good')
        .cancelBtn('No way!')
        .confirm(() =&gt; {})
        .cancel(() =&gt; {})
    }
  
  showAlert() {
          _dialog.alert()
            .title('Some title')
            .message('Some message')
            .okBtn('Sounds Good')
            .callback(() =&gt; {})
        }
  </code></pre>
  
  <p><strong>My service as it currently:</strong></p>
  
  <pre><code>export class DialogService {
  
  confirm() {
      bootbox.dialog({
        title: title,
        message: message,
        buttons: {
          cancel: {
            label: cancelBtn,
            className: 'btn-inverse btn-inverse-primary',
            callback: () =&gt; cancel()
          },
          okay: {
            label: okBtn,
            className: 'btn-inverse btn-inverse-primary',
            callback: () =&gt; confirm()
          }
        }
      })
    }
  
   alert() {
      bootbox.dialog({
        title: title,
        message: message,
        buttons: {
          okay: {
            label: okBtn,
            className: 'btn-inverse btn-inverse-primary',
            callback: () =&gt; callback()
          }
        }
      })
    }
  
  }
  </code></pre>
  
  <p>Obviously I would rather pass in the title, message, etc. from the component that's using my service, but I'm just not sure how to write the service to allow the usage to be done the way I would to.</p>