我已经有了一个全新的Electron Forge安装与angular2
模板。我碰到了角度依赖关系^4.3.1
,zone.js
到^0.8.14
并添加了hammerjs
到package.json
(使用Angular 4材质组件)。Electron Forge + 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/[email protected]: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
组件和app-search-view
组件上的*ngIf
。我曾经使用一个把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) {}
刚刚在最近的编辑中回答了你的问题,我希望这有助于:) – Quentin