Skip to content

Parent Router doesn't know Id of child #670

@DanieleRosada

Description

@DanieleRosada

Good morning,
I am using powerful routing, to rebuild the status after refreshing the page.
But I can't access the parameter :IdRiferimento from the father and therefore I don't know if I have to set the default value or load the previous route.

How can i build the infrastructure to this fairly common problem?
Thanks

@autoinject()
export class Riferimenti {


    columns: Array<ColDef> = [
        { headerName: this.localizer.t('assistenza:riferimenti.codice'), field: 'Codice' },
        { headerName: this.localizer.t('assistenza:riferimenti.nominativo'), field: 'Nominativo' },
        { headerName: this.localizer.t('assistenza:riferimenti.privacy'), field: 'Privacy', valueFormatter: (params) => AgGridValueFormatter.Boolean(params, this.localizer) }
    ];


    constructor(@newInstance(RiferimentiState) private state: RiferimentiState, private router: Router, private localizer: XLocale) { }

    configureRouter(config: RouterConfiguration, router: Router) {
        this.router = router;
        config.title = 'Riferimenti';

        config.map([
            { route: '', name: 'nessun-riferimento', moduleId: PLATFORM.moduleName('assistenza/utilities/no-selected') },
            { route: ':IdRiferimento', name: 'riferimento', moduleId: PLATFORM.moduleName('./route/riferimento') }
        ]);
    }

    async activate(params: ParamsRouting) {
        this.state.deselectAll();
        await this.state.getData(params.IdImpianto);

        console.error("riferimenti::", this.state.riferimenti);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions