<commit_before>import { ComponentRef, Injectable, ViewContainerRef } from '@angular/core';
import { ComponentType, MdDialogRef, MdDialog, MdDialogConfig } from '@angular/material';

import { Observable } from 'rxjs/Rx';


@Injectable()
export class DialogService {

  private readonly DEFAULT_CONFIG: MdDialogConfig = {
    disableClose: false,
    width: '',
    height: '',
    position: {
      top: '',
      bottom: '',
      left: '',
      right: ''
    }
  };

  constructor(private dialog: MdDialog) {
  }

  /**
   * Open a dialog and return an observable for the close event
   * @param dialogComp
   * @param config
   * @param containerElem
   * @param compInstance
   * @param compObj
   * @return {Observable<any>}
   */
  public open<T>(dialogComp: ComponentType<T>, config: MdDialogConfig = this.DEFAULT_CONFIG, containerElem: ViewContainerRef, compInstance: string[], compObj: any[]): Observable<boolean> {
    if (containerElem) {
      config.viewContainerRef = containerElem;
    }

    let dialogRef: MdDialogRef<T>;

    dialogRef = this.dialog.open(dialogComp, config);
    compInstance.forEach((singleInstance, i) => dialogRef.componentInstance[singleInstance] = compObj[i]);

    return dialogRef.afterClosed();
  }
}<commit_msg>- No overflow when dialog is opened<commit_after>import { Injectable, ViewContainerRef, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';
import { ComponentType, MdDialogRef, MdDialog, MdDialogConfig } from '@angular/material';

import { Observable } from 'rxjs/Rx';


@Injectable()
export class DialogService {

  private readonly DEFAULT_CONFIG: MdDialogConfig = {
    disableClose: false,
    width: '',
    height: '',
    position: {
      top: '',
      bottom: '',
      left: '',
      right: ''
    }
  };

  constructor(public dialog: MdDialog, @Inject(DOCUMENT) doc: any) {
    dialog.afterOpen.subscribe((ref: MdDialogRef<any>) => {
      if (!doc.body.classList.contains('no-scroll')) {
        doc.body.classList.add('no-scroll');
      }
    });
    dialog.afterAllClosed.subscribe(() => {
      doc.body.classList.remove('no-scroll');
    });
  }

  /**
   * Open a dialog and return an observable for the close event
   * @param dialogComp
   * @param config
   * @param containerElem
   * @param compInstance
   * @param compObj
   * @return {Observable<any>}
   */
  public open<T>(dialogComp: ComponentType<T>, config: MdDialogConfig = this.DEFAULT_CONFIG, containerElem: ViewContainerRef, compInstance: string[], compObj: any[]): Observable<boolean> {
    if (containerElem) {
      config.viewContainerRef = containerElem;
    }

    let dialogRef: MdDialogRef<T>;

    dialogRef = this.dialog.open(dialogComp, config);
    compInstance.forEach((singleInstance, i) => dialogRef.componentInstance[singleInstance] = compObj[i]);

    return dialogRef.afterClosed();
  }
}
{'fraction_non_alphanumeric': 0.13259284970496354, 'fraction_numerical': 0.0, 'mean_word_length': 3.7091503267973858, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2868505', 'n_tokens_mistral': 868, 'n_tokens_neox': 837, 'n_words': 198}