Skip to content

Commit

Permalink
fix(modals): fix issues with renderer2 in modal service
Browse files Browse the repository at this point in the history
  • Loading branch information
valorkin committed Sep 14, 2017
1 parent 04cab1e commit 73c8c6b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modal/bs-modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ComponentRef,
Injectable,
TemplateRef,
EventEmitter, Renderer2, RendererFactory2
EventEmitter, Renderer2, Injector
} from '@angular/core';

import { ComponentLoader } from '../component-loader/component-loader.class';
Expand Down Expand Up @@ -39,7 +39,9 @@ export class BsModalService {

private loaders: ComponentLoader<ModalContainerComponent>[] = [];

constructor(private _renderer: Renderer2, private clf: ComponentLoaderFactory) {
private _renderer: Renderer2;

constructor(private _injector: Injector, private clf: ComponentLoaderFactory) {
this._backdropLoader = this.clf.createLoader<ModalBackdropComponent>(
null,
null,
Expand Down Expand Up @@ -168,6 +170,7 @@ export class BsModalService {

// thx d.walsh
private getScrollbarWidth(): number {
this._renderer = this._renderer || this._injector.get(Renderer2);
const scrollDiv = this._renderer.createElement('div');
this._renderer.addClass(scrollDiv, CLASS_NAME.SCROLLBAR_MEASURER);
this._renderer.appendChild('body', scrollDiv);
Expand Down

0 comments on commit 73c8c6b

Please sign in to comment.