-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module:modal): add afterOpen/afterClose/afterAllClose/closeAll/o…
…penModals, adjust the boolean props and changeBodyOverflow and complete testing. (#1165) * feat(module:modal): add afterClose and more to improve communication capabilities close #1155 * feat(module:modal): add afterOpen/afterAllClose/closeAll/openModals, adjust the boolean props and changeBodyOverflow, complete testing. close #1162 * docs(changelog): add 0.7.0-beta.2 changelog for modal
- Loading branch information
1 parent
ab37862
commit 10227b8
Showing
19 changed files
with
607 additions
and
211 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
import { Component } from '@angular/core'; | ||
import { Component, ViewChild, OnInit } from '@angular/core'; | ||
import { NzModalComponent } from 'ng-zorro-antd'; | ||
|
||
@Component({ | ||
selector: 'nz-demo-modal-basic', | ||
template: ` | ||
<button nz-button [nzType]="'primary'" (click)="showModal()"><span>Show Modal</span></button> | ||
<nz-modal [(nzVisible)]="isVisible" nzTitle="The first Modal" (nzOnCancel)="handleCancel($event)" (nzOnOk)="handleOk($event)"> | ||
<nz-modal #modal *ngIf="modalValid" [(nzVisible)]="isVisible" nzTitle="The first Modal" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()"> | ||
<p>Content one</p> | ||
<p>Content two</p> | ||
<p>Content three</p> | ||
</nz-modal> | ||
`, | ||
styles: [] | ||
}) | ||
export class NzDemoModalBasicComponent { | ||
export class NzDemoModalBasicComponent implements OnInit { | ||
isVisible = false; | ||
modalValid = true; | ||
|
||
@ViewChild('modal') private modal: NzModalComponent; | ||
|
||
constructor() {} | ||
|
||
ngOnInit(): void { | ||
(window as any).modal = this.modal; // tslint:disable-line | ||
} | ||
|
||
showModal(): void { | ||
this.isVisible = true; | ||
window.setTimeout(() => this.modalValid = false, 2000); | ||
} | ||
|
||
handleOk($event: MouseEvent): void { | ||
handleOk(): void { | ||
console.log('Button ok clicked!'); | ||
this.isVisible = false; | ||
} | ||
|
||
handleCancel($event: MouseEvent): void { | ||
console.log('Button cancel clicked!', $event); | ||
handleCancel(): void { | ||
console.log('Button cancel clicked!'); | ||
this.isVisible = false; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.