let locFile = new Blob([fileData], {type: "image/svg+xml;charset-utf-8"});
let urlSrc = URL.createObjectURL(locFile);
this.router.navigate(urlSrc);
the url generated is “blob:http :// localhost:3001/a2b50924-c232-d14e-b300-d3ff5038b1e6”, already tested the url in another tab and get the file, but in aurelia get an error, “Error: Route not found: /blob:http :// localhost:3001/a2b50924-c232-d14e-b300-d3ff5038b1e6”
Not sure whether this helps but routes generally refer to position of view models in the aurelia project structure so you would need to use a route name that can be used as a directory/file name ruling out a url as route name. An image would, for example, be displayed using a view model comprising HTML and TS file. Note in Net Core that image files must be stored in the wwwroot folder as root with say an images subfolder and use HTML tag as follows:
Routes generally correspond to relative paths to view models (eg home) that appear in the project directory and can be explicitly created using code such as PLATFORM.moduleName(‘test’). The following TypeScript code can be used to create a route.
Hi, well the problem is that the svg(this particular case) file is generated locally in a canvas editor (fabric js framework) so no server storage is involved… on the other hand the “URL.createObjectURL(locFile)” function generate a local route, which is accessible to the browser and is where I get the error when try to navigate to this route, also no view models associated here since this is worked in the browser, hope this clarify a little more the problem
Just as a matter of interest does it work if you include a PLATFORM.moduleName(‘/blob:http :// localhost:3001/a2b50924-c232-d14e-b300-d3ff5038b1e6’); statement somewhere in the code. This should generate a reference to the route that needs to be present
i wil test, but the url is generate on the fly and requested automatically after generated not to be accessed by the user, also after added i have to remove the route because if the user make another change and generate a new url i will be creating garbage routes, that is why is treating the url as external with the call “this.router.navigate(urlSrc);”