Description
Hello,
I tried to integrate a relatively complex angular frontend into the init app.
The app loads perfectly fine. However, the events that are emitted by main.go (time) is not caught in the modules that are lazy loaded. The events are caught however, if I make a dummy function with event listener.
To Reproduce
- Initialize app
- Clone https://github.com/coreui/coreui-free-angular-admin-template as frontend.
-
`"build:dev": "ng build --configuration development",`
"dev": "ng serve --configuration development". Edit package.json to update these files
- In frontend directory, execute:
npm i @wailsio/runtime
- wails3 dev -port 4200.
Seems like Events.On works only when also subscribed in main.ts or app.ts even with a dummy.
main.ts
Events.On('', () => {
console.log("Dummy");
})
}
charts.component.ts
export class ChartsComponent implements OnInit {
ngOnInit(): void {
// throw new Error('Method not implemented.');
console.log("ChartsComponent.ngOnInit()");
Events.On('time2323', (time: any) => {
console.log("Time from go event charts-----------------------------------------------------: ", time.data);
this.chartBarData.set({
labels: [...this.months].slice(0, 7),
datasets: [
{
label: 'GitHub Commits',
backgroundColor: '#f87979',
data: [this.randomData, 0, 12, 39, 17, 42, 79]
}
]
});
})
}
### Expected behaviour
Events.On should work in charts component on loading as well.
### Screenshots
_No response_
### Attempted Fixes
I have added a Event listeneer to main.ts for the events to work. Not sure if it is an angular issue or wails issue.
### System Details
```shell
> wails3 doctor
Wails (v3.0.0-alpha.9) Wails Doctor
# System
WARNING: failed to read int from file: open /sys/devices/system/cpu/cpu0/online: no such file or directory
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Name | Ubuntu |
| Version | 24.04 |
| ID | ubuntu |
| Branding | 24.04.2 LTS (Noble Numbat) |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 9 7945HX with Radeon Graphics |
| GPU 1 | Navi 33 [Radeon RX 7700S/7600/7600S/7600M XT/PRO W7600] (Advanced Micro Devices, Inc. [AMD/ATI]) - Driver: amdgpu |
| Memory | 82GB |
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
# Build Environment
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| Wails CLI | v3.0.0-alpha.9 |
| Go Version | go1.23.1 |
| -buildmode | exe |
| -compiler | gc |
| CGO_CFLAGS | |
| CGO_CPPFLAGS | |
| CGO_CXXFLAGS | |
| CGO_ENABLED | 1 |
| CGO_LDFLAGS | |
| DefaultGODEBUG | asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1 |
| GOAMD64 | v1 |
| GOARCH | amd64 |
| GOOS | linux |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
# Dependencies
┌──────────────────────────────────────┐
| pkg-config | 1.8.1-2build1 |
| webkit2gtk | 2.46.6-0ubuntu0.24.04.1 |
| gcc | 12.10ubuntu1 |
| gtk3 | 3.24.41-4ubuntu1.2 |
| npm | 10.9.0 |
└────── * - Optional Dependency ───────┘
# Diagnosis
SUCCESS Your system is ready for Wails development!
Additional context
No response
Description
Hello,
I tried to integrate a relatively complex angular frontend into the init app.
The app loads perfectly fine. However, the events that are emitted by main.go (time) is not caught in the modules that are lazy loaded. The events are caught however, if I make a dummy function with event listener.
To Reproduce
"dev": "ng serve --configuration development". Edit package.json to update these filesnpm i @wailsio/runtimeSeems like
Events.Onworks only when also subscribed in main.ts or app.ts even with a dummy.main.ts
charts.component.ts
Additional context
No response