在NavigationByUrl时Angular动态路由名称不起作用的情况下,需要刷新页面

问题描述

这是我的主要路线文件

     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel,'Excel2007');
            header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
            header('Content-disposition: attachment;filename=Otchet.xlsx');
            header('Cache-Control: max-age=0');
            ob_end_clean();
            $objWriter->save('PHP://output');
            exit;

这是page.module路由

 let baseRoute= Config.loginFirstName==null ? 'abcd':Config.loginFirstName;
 
const routes: Routes = [
  {path: '',redirectTo: '/'+baseRoute+'/'+Config.role+'/dashboard/home',pathMatch: 'full' },{path:'help',component:HelpComponent},{path:'register',component:RegisterComponent},{path:'forget-password',component:ForgetpasswordComponent},{ path: baseRoute,loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule) },{path:'**',component:NotfoundComponent}
];

当某人以供应商名称“ xyz”登录时出现了问题,因此其重定向到“ xyz / vendor”路由并首次运行,但是当以名称“ abc”作为客户登录时,其路由将为abc / customer,则其重定向无效。

谢谢

解决方法

最后我可以通过预加载策略来解决此问题

def print_outer_and_inner(outer_recs,inner_recs):
    for name,source in {(o_rec.name,o_rec.source): None for o_rec in outer_recs}:
        print(f'{name} ({source})')
        print('=' * 15)
        for o_rec in outer_recs:
            if o_rec.name == name:
                print(f'* [{o_rec.thing}]: . "{o_rec.description}"')
        print()
        for sub_name,sub_source in {(i_rec.in_name,i_rec.in_source): None for i_rec in inner_recs}:
            print(f'{sub_name} ({sub_source})')
            print('-' * 15)
            for i_rec in inner_recs:
                if i_rec.in_name == sub_name:
                    print(f'* [{i_rec.thing}]: . "{i_rec.description}"')
            print()


print_outer_and_inner(o,i)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...