235229 (13) [Avatar] Offline
#1
Any chance to add use case for routing to "modal floating window/form" to chapter 3?
I do understand that this modal window might be implemented as view, but still...
240938 (5) [Avatar] Offline
#2
I struggled with this as well. My scenario was displaying details of a search result, where the details were in a modal. My conclusion was to create a child route that injected the dialog template, with initialization code that opened the dialog template.

My routes were as follows:

/search <search in progess, no results returned>
/search/result <displaying results>
/search/result/detail/8568 <showing modal atop results for product 8568>

In my dialog class (TitleDetailDialog), I'm using bootstrap's dialog...

    
public ngAfterViewInit(): void {
        this.showDialog();
    }


 private showDialog() {
        let closureThis: TitleDetailDialog = this;

                          
                $( '#myModal' )
                    .modal( { show: true, background: true } )
                    .on( 'hidden.bs.modal', function ( e ) {

                        closureThis.router.navigate( ['../../'], {
                            queryParams: {},
                            relativeTo : closureThis.activeRoute
                        } );
                    } );
            } );
        
    }