我已经用angular2
模板重新安装了 Electron Forge。我将 Angular 依赖项添加到^4.3.1
、zone.js
to^0.8.14
并添加hammerjs
到package.json
(以使用 Angular 4 材质组件)。
src/app
然后我在目录中添加了一个功能性 NG4 应用程序的源代码。
运行electron-forge start
控制台输出正确且应用程序启动时,但 DevTools 显示此错误:
Unhandled Promise rejection: Template parse errors:
'anonymous' is not a known element:
1. If 'anonymous' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("tin\Desktop\ef-ng\node_modules\electron-compile\lib\protocol-hook.js:216:25)
at Generator.next ([ERROR ->]<anonymous>)
at step (C:\Users\Quentin\Desktop\ef-ng\node_modules\electron-compile\lib\protocol-h"): ng:///C:/Users/Quentin/Desktop/ef-ng/src/app/app.component.html@4:23
这是我的app.component.html
样子:
<app-main-toolbar></app-main-toolbar>
<app-tree-item-tabs></app-tree-item-tabs>
<app-search-view *ngIf="appState.searchIsVisible"></app-search-view>
<app-media-view *ngIf="appState.activeMedia" [media]="appState.activeMedia"></app-media-view>
如果我用它替换它,那么它运行正常(但当然这不是我想要的):
<app-main-toolbar></app-main-toolbar>
<app-tree-item-tabs></app-tree-item-tabs>
<app-search-view></app-search-view>
请注意,我删除了组件app-media-view
和一个。我曾经使用一个技巧添加到我的声明中,但这在这里不起作用。*ngIf
app-search-view
moduleId : module.id.split('\\').join('/'),
@Component
我真的被困在这里了。
任何想法?谢谢!
编辑
以下media
是在 中定义的方式app-media-view
:
get media(): Media {
return this._media;
}
@Input()
set media(value: Media) {
this._media = value;
// More things
}
以下appState
是在 中定义的方式AppComponent
:
constructor(
protected bootstrap:BootstrapService,
public appState: AppStateService) {}