Last active
October 4, 2018 11:16
-
-
Save LironHazan/41256b20da974e0c64fe3fa594249e98 to your computer and use it in GitHub Desktop.
test paste
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable, TemplateRef} from '@angular/core'; | |
import {MatDialog} from '@angular/material'; | |
import {ComponentType} from '@angular/cdk/typings/portal'; | |
import {MyDialogComponent} from './my-dialog.component'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class MyDialogService { | |
constructor(public dialog: MatDialog) { } | |
private conf = { autoFocus: true }; | |
private mediumConf = {height: 'auto', width: '70%', ...this.conf}; | |
public open<T>(component: ComponentType<T> | TemplateRef<T>, data: any) { | |
this.mediumConf['data'] = { component, data }; | |
const conf = this.mediumConf; | |
return this.dialog.open(MyDialogComponent, conf); | |
} | |
public error<T>(data: any) { | |
return this.dialog.open(AlertDialogComponent, {panelClass: 'alert-panel', data: data}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment