【问题标题】:Building electron app breaks my angular 2 app构建电子应用程序破坏了我的 Angular 2 应用程序
【发布时间】:2017-05-18 22:15:56
【问题描述】:

因此,在我运行它时构建了我的电子 Angular 2 应用程序后,我的 Angular 2 应用程序不再工作了。没有错误出现,但应用程序不再知道如何路由,所以它只是根据我的 index.html 卡在加载中。这与 asar 打包我的应用程序的方式有关吗?我该怎么做才能让它再次运行? 文件结构:

./package.json

----->./electron/main.js

 src/---> index.html
          app/app.routing.ts
          app/app.component.ts
          app/app.module.ts
          app/home/home.component.ts
          app/...All The other components......

index.html:

  <!doctype html>
 <html>
  <head>
  <meta charset="utf-8">
  <title>New</title>
  <script>
   document.write('<base href="' + document.location + '" />');
  </script>

  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">

   <script>window.$ = window.jQuery = require('./public/jquery/dist/jquery.min.js');</script>
   <script src="./public/bootstrap/dist/js/bootstrap.min.js"></script>

   <link rel="stylesheet" href="./public/bootstrap/dist/css/bootstrap.min.css">

   <link rel="stylesheet" href="./public/bootstrap/dist/css/bootstrap-theme.min.css">

  </head>
  <body>
     <app-root>
        Loading...
     </app-root>
  </body>
 </html>

【问题讨论】:

    标签: angular electron


    【解决方案1】:
    href="' + document.location + '"
    

    替换为

    href="./" 
    

    here 我就是这样做的

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-02
      • 2016-05-16
      • 1970-01-01
      • 2017-09-08
      • 1970-01-01
      • 1970-01-01
      • 2018-02-09
      • 1970-01-01
      相关资源
      最近更新 更多