I have a requirement in Angular2 where I need to open a first popup and the user would enter some values. On some user event i.e. a button click I need to close that popup and open another popup with the values pre-populated entered by the user in the first popup.
I have created a plunker where I have created a Login component which is my first popup and Home component which is the second popup. On entering the user credentials it should navigate to the home component. I am bit struck here i.e. how to pass the username values from the first popup to the second, also how to close the first and load the second popup?
Can anyone help me with this issue, and let me know what are the changes need to be done in my plnkr?
export class LoginModal implements CloseGuard, ModalComponent<CustomModalContext> {
context: CustomModalContext;
public username: string;
public password: string;
constructor(public dialog: DialogRef<CustomModalContext>, public modal: Modal) {
this.context = dialog.context; // this is the dialog reference
dialog.setCloseGuard(this);
}
openHome()
{
return this.modal.open(HomeModal, overlayConfigFactory({ username }, BSModalContext));
}
}