Angular 4页面没有看到自定义的JS文件,没有刷新页面

问题描述:

我有一些自定义的js文件,我将它们全部导入到angular-cli.json文件中。问题在于,页面在从一个页面路由到另一个页面后没有刷新页面时看不到它们。Angular 4页面没有看到自定义的JS文件,没有刷新页面

角cli.json文件:

"styles": [ 
     "styles.css", 
     "./assets/plugins/bootstrap/css/bootstrap.css", 
     "./assets/plugins/node-waves/waves.css", 
     "./assets/plugins/animate-css/animate.css", 
     "./assets/plugins/morrisjs/morris.css", 
     "./assets/plugins/jquery-datatable/skin/bootstrap/css/dataTables.bootstrap.css", 
     "./assets/css/style.css", 
     "./assets/css/themes/all-themes.css" 
     ], 
     "scripts": [ 
     "./assets/plugins/jquery/jquery.min.js", 
     "./assets/plugins/bootstrap/js/bootstrap.js", 
     "./assets/plugins/bootstrap-select/js/bootstrap-select.js", 
     "./assets/plugins/jquery-slimscroll/jquery.slimscroll.js", 
     "./assets/plugins/node-waves/waves.js", 
     "./assets/plugins/jquery-countto/jquery.countTo.js", 
     "./assets/plugins/raphael/raphael.min.js", 
     "./assets/plugins/morrisjs/morris.js", 
     "./assets/plugins/chartjs/Chart.bundle.js", 
     "./assets/plugins/flot-charts/jquery.flot.js", 
     "./assets/plugins/flot-charts/jquery.flot.resize.js", 
     "./assets/plugins/flot-charts/jquery.flot.pie.js", 
     "./assets/plugins/flot-charts/jquery.flot.categories.js", 
     "./assets/plugins/flot-charts/jquery.flot.time.js", 
     "./assets/plugins/jquery-sparkline/jquery.sparkline.js", 
     "./assets/plugins/jquery/jquery.min.js", 
     "./assets/plugins/bootstrap/js/bootstrap.js", 
     "./assets/plugins/node-waves/waves.js", 
     "./assets/plugins/jquery-validation/jquery.validate.js", 
     "./assets/plugins/jquery-datatable/jquery.dataTables.js", 
     "./assets/plugins/jquery-datatable/skin/bootstrap/js/dataTables.bootstrap.js", 
     "./assets/plugins/jquery-datatable/extensions/export/dataTables.buttons.min.js", 
     "./assets/plugins/jquery-datatable/extensions/export/buttons.flash.min.js", 
     "./assets/plugins/jquery-datatable/extensions/export/jszip.min.js", 
     "./assets/plugins/jquery-datatable/extensions/export/pdfmake.min.js", 
     "./assets/plugins/jquery-datatable/extensions/export/vfs_fonts.js", 
     "./assets/plugins/jquery-datatable/extensions/export/buttons.html5.min.js", 
     "./assets/plugins/jquery-datatable/extensions/export/buttons.print.min.js", 
     "./assets/js/admin.js", 
     "./assets/js/pages/tables/jquery-datatable.js", 
     "./assets/js/pages/examples/sign-in.js", 
     "./assets/js/pages/index.js", 
     "./assets/js/demo.js" 
     ] 

app.module.ts:

RouterModule.forRoot([ 
     { 
      path: 'Main', component: MainComponent, canActivate: [], children: [ 
       { path: '', component: HomeComponent }, 
       { path: 'Users', component: UsersComponent }, 
      ] 
     }, 
     { path: 'Login', component: LoginComponent }, 
     { path: '**', redirectTo: 'Login' } 
    ]) 

你确定你正在引发赶走使用ngOnit?