嗨,我是Angular 2的新手。我使用的是angular2 mdl對話框,我想在登錄成功時關閉對話框。但我不知道如何關閉dialog.Can任何一個可以幫助我,請如何在組件文件中關閉mdl對話框
<mdl-dialog #loginDialog [mdl-dialog-config]="{
clickOutsideToClose: true,
isModal:true,
openFrom: loginButton,
enterTransitionDuration: 400,
leaveTransitionDuration: 400}">
<h3 class="mdl-dialog__title">Login</h3>
<div class="mdl-dialog__content">
<form name='loginForm' #loginForm="ngForm">
<md-input-container>
<md-icon class="inputIcon">perm_identity</md-icon>
<input type="text" mdInput name="Email" [(ngModel)]="userEmail" placeholder="Email" #Email="ngModel" pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$" required>
</md-input-container>
<div [hidden]="Email.valid || Email.pristine" class="error">
Email is invalid!
</div>
<md-input-container>
<md-icon class="inputIcon">lock</md-icon>
<input type="password" mdInput name="Password" [(ngModel)]="password" placeholder="Password" required>
</md-input-container>
<button class="btn loginBlue" [disabled]="!loginForm.form.valid" (click)="loginEmail(); false">Login</button>
<p style="text-align: center;font-size: 14px;font-family: 'Open Sans';color: #909090;margin-top: 20px;margin-bottom: 15px;">or</p>
<button class="loginRed" (click)="loginGoogle(); false"><img src="/images/google_icon.png" class="google">Login using google</button>
</form>
</div>
</mdl-dialog>
我們需要導入MdDialog? –
和loginDialog也是undefined ..你能不能請詳細解釋一下 –
查看我更新的答案,然後一步一步按照步驟進行。 – Aravind