From what I read on the net in order to include js script in a page (Web Assembly version of MAUI Blazor) I need to do it in wwwroot/index.html using standard 'script' tag.
Then I access js methods from any razor page through JSinterop. It works fine. I can call js and call C# methods from js also.
I have many pages in the app though.
Wondering how to load different js scripts depending on page that is currently on the screen?
I cannot add js using 'script' tag on a razor page itself as it doesn't allow it and don't want to have one global js script with loads of methods supporting all pages I have in the app.
Any help will be greatly appreciated.
If your main worry is having a single file with tons of JS in it, then simply use JS modules and structure your JS code as you see fit, with individual bits of logic contained in separate files. However, this would ultimately still be a single script tag, which would import the entire JS you have(e.g. a main JS file importing all of the rest of the modules, which is then loaded in the index.html).
If you are worried about loading a large script file initially and/or want to load a specific script for a specific page, then you should look into this thread: Blazor Server: load js scripts only on certain pages, not on all