-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(modal): allow open instance of component into the dialog (#163)
- Loading branch information
1 parent
6a1a4bc
commit 8315eef
Showing
10 changed files
with
150 additions
and
16 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
The dialog is currently divided into 3 modes - `default`, `confirm box`, `custom`. | ||
|
||
|
||
#### Using service to create Confirm Mode | ||
|
||
```ts | ||
showConfirm() { | ||
this.modalService.success({ | ||
mcContent : 'Save changes made to the request "All assets with Windows"?', | ||
mcOkText : 'Save', | ||
mcCancelText: 'Cancel', | ||
mcOnOk : () => console.log('OK') | ||
}); | ||
} | ||
``` | ||
|
||
#### Using service to open modal Custom Mode | ||
|
||
```ts | ||
let dialogRef = modalService.open({ | ||
mcComponent: CustomComponent | ||
}); | ||
``` | ||
|
||
```ts | ||
@Component({/* ... */}) | ||
export class CustomComponent { | ||
constructor(private dialogRef: McModalRef) { } | ||
|
||
closeDialog() { | ||
this.modal.destroy({ data: 'this the result data' }); | ||
} | ||
} | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Directive } from '@angular/core'; | ||
|
||
|
||
@Directive({ | ||
selector: `[mc-modal-title], mc-modal-title, [mcModalTitle]`, | ||
host: { | ||
class: 'mc-modal-header mc-modal-title' | ||
} | ||
}) | ||
export class McModalTitle {} | ||
|
||
@Directive({ | ||
selector: `[mc-modal-body], mc-modal-body, [mcModalBody]`, | ||
host: { | ||
class: 'mc-modal-body' | ||
} | ||
}) | ||
export class McModalBody {} | ||
|
||
@Directive({ | ||
selector: `[mc-modal-footer], mc-modal-footer, [mcModalFooter]`, | ||
host: { | ||
class: 'mc-modal-footer' | ||
} | ||
}) | ||
export class McModalFooter {} |
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