Angular Material Dialog not closing after navigation

后端 未结 5 2493
醉酒成梦
醉酒成梦 2021-02-20 09:43

I\'m working on an application that shows an overview of entities in a datatable. Every entity has linked entities that are shown as \'xxx linked entities\' in a column. When th

5条回答
  •  你的背包
    2021-02-20 10:11

    There were no errors or warnings but closeOnNavigation: true started working for me only after adding these providers to the module with the dialog:

    import { Location, LocationStrategy, PathLocationStrategy, APP_BASE_HREF } from "@angular/common";
    
    ...
        providers: [
            Location,
            { provide: LocationStrategy, useClass: PathLocationStrategy },
            { provide: APP_BASE_HREF, useValue: '/' }
        ]
    ...
    

    I suspect that in my case this was because of using UI-Router and never initializing the built in Angular router before.

提交回复
热议问题