我有一个侧边栏菜单脚本文件,位于我包含到index.html
. 每当我刷新home/dashboard
子路由时,脚本就会工作,如果我从初始路由重定向/
到home/dashboard
侧边栏显示/隐藏按钮不起作用(这个逻辑是我提到的脚本的一部分)一旦我刷新页面,外部脚本将正常工作。这是我的路由模块
app.routing.module.ts
const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
//{ path: 'login', component: LoginComponent, },
{ path: 'home', component: HomeComponent,
children:[
{ path: '', redirectTo: 'dashboard', pathMatch: 'full' },
{ path: 'dashboard', component: DashboardComponent,},
{ path: 'totalapproved', component: ApprovedComponent,},
{ path: 'campaign', component: CampaignmanagerComponent,},]}
]
有没有办法将外部资产脚本添加到 angular.json 文件?