0

i am trying to do the mdDidalog in angular2, but its show me like this : enter image description here

Something is going wrong... i import next:

import { MdDialog, MdDialogRef, MdDialogConfig } from '@angular/material';

Constructor:

  constructor(
      public dialog: MdDialog,
      public viewContainerRef: ViewContainerRef
    ){}

its function calling new modal:

  public openAddPromoModal() {
const config = new MdDialogConfig();
config.viewContainerRef = this.viewContainerRef;

const dialogRef = this.dialog.open(AddNewCandidat, {
  height: '400px',
  width: '600px'})

dialogRef.afterClosed().subscribe(newPromo => {
    });
  }
}

Its my index.html

<!DOCTYPE html>
<html>
  <head>
    <base href="/">
    <title>Angular With Webpack</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://unpkg.com/@angular/material/prebuilt-themes/indigo-pink.css" rel="stylesheet">
  </head>
  <body>
    <my-app>Loading...</my-app>
  </body>
</html>
shoopik
  • 309
  • 2
  • 5
  • 15

1 Answers1

0

Your function should be like

public openAddPromoModal() {
    const config = new MdDialogConfig();
    config.width = '600px';
    config.height: '400px';

const dialogRef = this.dialog.open(AddNewCandidat, config);

dialogRef.afterClosed().subscribe(newPromo => {
    });
  }
}
Shailesh Ladumor
  • 7,052
  • 5
  • 42
  • 55