New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(modal): add initial version of the modal service #609
feat(modal): add initial version of the modal service #609
Conversation
@@ -16,13 +17,14 @@ import {NgbTooltipModule} from './tooltip'; | |||
import {NgbTypeaheadModule} from './typeahead'; | |||
|
|||
export {NgbPanelChangeEvent} from './accordion'; | |||
export {NgbModal} from './modal'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't NgbModalRef and NgbModalOptions be exported too? They're the return type and the argument type of NgbModal.open()
, which is the public API, so client code should be able to refer to these types, too, shouldn't they?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should, I thought I've exported them. This is still WIP so thx for catching this one!
}); | ||
} | ||
|
||
private _getContentNodes(content: string | TemplateRef<any>, context: ModalContentContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What type of object is this returning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An array of DOM nodes. Will add return type.
This LGTM - it's possible I missed something, so one other person reviewing probably would be a good idea. |
this.modalService.open(content).result.then((result) => { | ||
this.closeResult = `Closed with: ${result}`; | ||
}, (reason) => { | ||
this.closeResult = `Dismissed with: ${reason}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
escape and backdrop click return 1
and 0
as dismiss reasons which are NgbDismissReasons
values. But it looks strange in the demo → should switch over enum values and display text?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
LGTM, some comments in the code plus:
|
const nodes = this._getContentNodes(content, modalContentContext); | ||
const windowCmptRef = this._viewContainerRef.createComponent(this._windowFactory, 0, this._injector, nodes); | ||
let backdropCmptRef; | ||
let ngbModalRef; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we type this var and the previous one?
Nothing against, minus a minimal nitpick. |
Very rough implementation of the
NgbModal
service. Opening this PR early on so we can discuss the details. Check discussion in #3 (comment) for more details / remaining work.Even if there is still more work that needs to be done I believe that this is the first good shoot witch should have stable API (I mean, remaining work shouldn't have non-backward compatible API changes). As such I think that we can go ahead and land it so users can play with it.
Please review.