Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular Route/URL error after refresh #655

Closed
shidandev opened this issue Dec 20, 2022 · 3 comments
Closed

Angular Route/URL error after refresh #655

shidandev opened this issue Dec 20, 2022 · 3 comments

Comments

@shidandev
Copy link

Can you help how to overcome virtual route for angular compatible with eel after refresh, hosting i use .htaccess but in this i have no clue to proceed

@shidandev
Copy link
Author

shidandev commented Dec 26, 2022

i found solution, use this reference, but python eel can't invoke function from js eel, from my understanding, python init -> my directory and start without detecting eel.expose in every component in angular, except eel.expose in index.html

workaround for python pass data to angular: #655 (comment)

@nricciardi
Copy link

Very good, I report here briefly the solutions reported in the references in case they are no longer available in the future:

  • use Angular Universal
  • use hash in route (in app-routing.module.ts use this: RouterModule.forRoot(routes, { useHash: true }))

You should can close issue now.

@shidandev
Copy link
Author

Update for Angular, python eel can invoke simple function put on index.html

step 1. app.component.ts,

window["dummy"] = new Subject() //<=== Subject come from rxjs
window["dummy"].subscribe((res) => {
//do anything you want from data subscribe
console.log(res);
// {"msg":"something from python"}
})

step 2. index.html

eel.expose(sendData);
function sendData(data){
if(data){
window["dummy"].next(data); //<== window["dummy"] created as Subject Instance from rxjs
}
}

!!! make sure key "dummy" created on window object as Subject Instance...

then on python, just call function declare on index.html....

eel.sendData({"msg":"something from python"})

try to make angular service listen to window["dummy"] based on your system requirement.... or make it dynamic...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants