-
Notifications
You must be signed in to change notification settings - Fork 408
Implement electron-zone #537
Comments
@JiaLiPassion navigate via the menu at the top of the screen: |
I cleaned up my node_modules, I can reproduce now. |
any update on this? i can use angular 2 only up to version 2.1 so far with electron |
For now, you have to do like this let pageMenu = new MenuItem({
label: 'Page',
submenu: [
{ label: 'Page 1', click: Zone.current.wrap(() => this.router.navigate(['/page1'])) },
{ label: 'Page 2', click: Zone.current.wrap(() => this.router.navigate(['/page2'])) },
],
}); |
I don't only have a problem with the router. I have issues in general like with change detection and such. |
@sittingbool, could you give an example through some sample code or repository. |
@sittingbool , if your problem is related with electron menu or something like that, you could use the let pageMenu = new MenuItem({
label: 'Page',
submenu: [
{ label: 'Page 1', click: Zone.current.wrap(() => this.router.navigate(['/page1'])) },
{ label: 'Page 2', click: Zone.current.wrap(() => this.router.navigate(['/page2'])) },
],
}); If your problem is related with your application(not electron), you may check the #533 to see whether it is the same problem, if it is , you can check PR #608 to see whether it resolve your problem or not. |
Any progress on this issue with electon menus and zone? |
I really would appreciate that too |
@sittingbool The suggested workarround of wrapping my code with This is how my code looks like when invoking an Electron menu item:
ChangeDetector is now picking up any changes of |
I don't have this Issue with menu alone. I have a general Issue with the Zone- Implementation in electron. The behavior has been overwritten from the default as far as I could see and Zone.js is reacting allergic to it. |
@sittingbool , could you post a reproduce repo? |
@pamtbaau , if it is just |
@JiaLiPassion, So far, I've encountered the problem when setting a property inside an Electron initiated callback. E.g. a (popup)menu callback or dialog callback. I've created a repo to reproduce the three scenarios. |
Having the same issues like @sittingbool, |
@daganchen , this issue has nothing to do with angular version, I am implementing an |
Hi All, I've just found a solution that works for Angular 5 and all latest Codes for Node.js and Typescript: Follow:
then, use the code as follow
Make Sure the pages exists on routing file, otherwise will throw many route errors. More details check Wonderfull Lib from ThorstenHans here |
@ameagol I'm not using Angular's routing, but the above mentioned workaround works fine for the original issue. Maybe the workaround might also work in your use case, which might make the extra library a bit superfluous for an issue that will be properly fixed in due time. I use menus in the following way:
|
@JiaLiPassion Great news! Thanks for this zone fixup for Electron. Would love to test this out in my application. When will it be released and how should I use it? |
@pamtbaau, thank you, I have created a sample repo to describe how to use, https://github.com/JiaLiPassion/zone-electron, please use the new release to test your application. |
Maybe I have a wrong perception as to how this feature solves the electron zone issues. The next piece of code is a declaration of a menuitem using
I hoped I could now simply remove the
But no luck... Without the |
@pamtbaau , I have tested the and make sure
|
@JiaLiPassion I have tested your suggestions, but it's not working
Same with my own app. It only works when installing |
@pamtbaau , thank you for your detail information, it seems |
@pamtbaau , I have checked |
Electron uses both browser and some node APIs (EventEmitter, etc), and events fired by electron APIs (MenuItem, for example) cause angular to drop out the zone. Ref angular/angular#13363
We should implement an electron zone patch, that combines the browser APIs as well as a subset of the node APIs available to electron.
The text was updated successfully, but these errors were encountered: