I have a script that is loaded with JavaScript code in an angular application:
function reloadgame(gameId, user) {
window.location = window.location.href.replace(/demo/ig, 'Real');
return false;
}
The script doesnt work, and my suspicion is because of the way angular works. The conventional known ways failed to work too such as the ways described here.
I tried to reload the page with this function:
location.reload();
and it worked.
However, I don't want to refresh the page. I want to redirect the user to a new path.
How can it be achieved given that I use JavaScript in an angular 5 app?