angular - Index.html 未链接到电子角度中的 app.component
问题描述
我正在尝试将电子添加到现有的角度项目中。
我像新应用程序一样添加,我认为我配置正确但是当我运行我的电子应用程序时,屏幕上什么都没有显示。
这是 main.js,我如何加载电子应用程序的 index.html。
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('./src/index.html')
win.setMenu(null);
}
索引.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 的构造函数中添加了一个控制台,但没有打印。
当我运行这个电子子应用程序时,屏幕上什么也没有显示。看起来像 index 和 app.component.ts,而不是链接。
我错过了什么?
解决方案
按照这个存储库。它将帮助您使用开发环境和生产环境设置角度。
推荐阅读
- javascript - Mapbox GL JS Api 调用控件
- typeorm - typeorm querybuilder中的列名作为变量
- angular - 带有可选参数的角路由器
- python - 如何在同一图中显示密度图 kde 值和直方图频率值?蟒蛇,seaborn,jupyterlab
- android - 如何保存从 Kotlin 中另一个活动传递的数据?
- php - 删除多维数组的索引以转换为许多一维数组的列表 PHP
- python - 如何使用 pathlib.Path().glob() 遍历目录并在每次迭代时读入 2 个文件
- rxjs - 从可订阅对象创建可观察对象?
- javascript - 如何在 AMP HTML 中设置自定义 cookie 名称
- javascript - 颜色渐变不起作用leaflet.JS