在Angular 4

时间:2017-10-13 21:30:10

标签: javascript angular typescript

我一直在使用带有AdminLTE的Angular 4,它需要运行一些脚本来正确加载。 我在index.html中包含脚本,第一页工作正常...问题是当我路由到另一个需要加载相同脚本的页面时(从登录页面到主页)。页面加载正常没有错误,但由于脚本没有加载,一些按钮,数据库不起作用。如果我刷新浏览器,页面再次显示正常。我使用了角4路由器 的index.html

    <body class="hold-transition skin-green sidebar-mini">

  <app-root>Loading...</app-root>
  <!--reCaptcha -->
  <script src='https://www.google.com/recaptcha/api.js'></script>
  <!-- jQuery 3 -->
  <script src="assets/bower_components/jquery/dist/jquery.min.js"></script>
   <!-- Bootstrap 3.3.7 -->
  <script src="assets/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  <!-- SlimScroll -->
  <script src="assets/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
  <!-- FastClick -->
  <script src="assets/bower_components/fastclick/lib/fastclick.js"></script>
  <!-- AdminLTE App -->
  <script src="assets/dist/js/adminlte.min.js"></script>
  <!-- AdminLTE for demo purposes -->
  <script src="assets/dist/js/demo.js"></script>
  <!-- CK Editor -->
  <script src="assets/bower_components/ckeditor/ckeditor.js"></script>
  <script>
    $(function () {
        // Replace the <textarea id="editor1"> with a CKEditor
        // instance, using default configuration.
        CKEDITOR.replace('editor1')
        //bootstrap WYSIHTML5 - text editor
        $('.textarea').wysihtml5()
    })
  </script>
  <script>
    $(document).ready(function () {
        $('.sidebar-menu').tree()
    })
  </script>

</body>

路线

const appRoutes: Routes = [
  { path: '', component: LoginComponent },
  { path: 'accueil', component: AccueilComponent },
  { path: 'dossier', component: DossierComponent },

];

RouterModule.forRoot(
      appRoutes,
      { enableTracing: true } // <-- debugging purposes only
    )

0 个答案:

没有答案