Javascript 电子+;角度12';行不通
我正在开发一个基于Electron+Angular的web应用程序。项目配置很好。在我的web应用程序中,我有四个页面,在其中一些页面(不是所有页面)中,我有一些不工作的指令。特别是我有一个带有*ngIf指令的div容器:Javascript 电子+;角度12';行不通,javascript,node.js,angular,typescript,electron,Javascript,Node.js,Angular,Typescript,Electron,我正在开发一个基于Electron+Angular的web应用程序。项目配置很好。在我的web应用程序中,我有四个页面,在其中一些页面(不是所有页面)中,我有一些不工作的指令。特别是我有一个带有*ngIf指令的div容器: <div *ngIf="!!configurationFile ">....</div> configurationFileContent是一个RxJS主题类: configurationFileContent: Subject&
<div *ngIf="!!configurationFile ">....</div>
configurationFileContent是一个RxJS主题类:
configurationFileContent: Subject<ConfigurationFileModelModel> = new Subject<ConfigurationFileModelModel>();
我在控制台端使用大量日志进行了大量测试,“configurationFile”变量不是空的,但是div组件仍然不可见
我尝试了很多解决方案,但没有一个奏效。更改检测设置为默认值
这是一个电子积分问题吗?如何解决
更新
我认为这是一个区域执行问题,因为在其中一页中,我将变量更新为ngZone,如下所示:
constructor(private electronService: ElectronService,
private httpClient: HttpClient,
private comunication: ComunicationBetwenComponentsService,
private ngzone:NgZone,
private translate: TranslateService) {
this.subscription = this.comunication.message.subscribe(res => {
if (res === 'refresh'){
ngzone.run(() => {
this.initializeVariables();
});
}
});
}
有没有一种方法可以让区域在没有此解决方法的情况下正常工作
this.configurationFileContent.next(JSON.parse(data))
constructor(private electronService: ElectronService,
private httpClient: HttpClient,
private comunication: ComunicationBetwenComponentsService,
private ngzone:NgZone,
private translate: TranslateService) {
this.subscription = this.comunication.message.subscribe(res => {
if (res === 'refresh'){
ngzone.run(() => {
this.initializeVariables();
});
}
});
}