angular - Index.html不在 Electron Angular 中链接到app.component

标签 angular electron angular10

我正在尝试将 Electron 添加到现有的 Angular 项目中。
我添加的就像新的应用程序一样,我认为我的配置正确,但是当我运行 Electron 应用程序时,屏幕上没有任何显示。
这是main.js,我如何加载 Electron 应用程序的index.html。

function createWindow () {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })

  win.loadFile('./src/index.html')      
  win.setMenu(null);
}
index.html =>
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Testing</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- <link rel="icon" type="image/x-icon" href="favicon.ico"> -->
</head>
<body>
  <app-root></app-root>
</body>
</html>
app.component.html
<h1 class="app-root">Welcome to sub-app1!</h1>
<router-outlet></router-outlet>
这是app-router.component.ts
const routes: Routes = [
  {
    path: '',
    redirectTo: 'test',
    pathMatch: 'full'
  },
  {
    path: 'test',
    component: TestComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
我在app.component.ts的构造函数中添加了一个控制台,但没有显示任何内容。
当我运行此 Electron 子应用程序时,屏幕上没有任何显示。看起来像index和app.component.ts,而不是链接。
我想念的是什么?

最佳答案

遵循this存储库。它会帮助您与开发环境和生产环境建立一定的 Angular 。

关于angular - Index.html不在 Electron Angular 中链接到app.component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65978016/

相关文章:

html - Angular 4 CLI ng build 不将 scss 转换为 css

angular - 在 Angular7 中的 HTTP 请求期间显示微调器

javascript - Electron 在窗口中形成透明圆圈?

Angular:在 VSCode 中运行 ngcc 会导致性能问题

sass - 从 Angular 9 更新到 Angular 10 后 `SCSS` 不起作用

Angular:使用 Typescript 使表单值只读变灰并使数据获取有效

javascript - 将 xlsx 转换为 json 时日期格式发生变化

javascript - 使用递归数组递归组件加载

electron - 将角度与 Electron JS一起使用有什么好处

javascript - Electron 和 Node : How to read an SQL file?