fix(ssr): fix angular global window and document references

This commit is contained in:
Adam Bradley
2019-02-25 16:43:41 -06:00
committed by GitHub
parent ceaef7eed2
commit f44c17e03b
19 changed files with 200 additions and 214 deletions

View File

@ -1,26 +1,26 @@
import { proxyMethod } from './util';
export class OverlayBaseController<Opts, Overlay> {
constructor(private ctrl: string) {}
constructor(private ctrl: string, private doc: Document) {}
/**
* Creates a new overlay
*/
create(opts?: Opts): Promise<Overlay> {
return proxyMethod(this.ctrl, 'create', opts);
return proxyMethod(this.ctrl, this.doc, 'create', opts);
}
/**
* When `id` is not provided, it dismisses the top overlay.
*/
dismiss(data?: any, role?: string, id?: string): Promise<void> {
return proxyMethod(this.ctrl, 'dismiss', data, role, id);
return proxyMethod(this.ctrl, this.doc, 'dismiss', data, role, id);
}
/**
* Returns the top overlay.
*/
getTop(): Promise<Overlay> {
return proxyMethod(this.ctrl, 'getTop');
return proxyMethod(this.ctrl, this.doc, 'getTop');
}
}