I am working on an Angular 4 application that is using Webpack, and I am currently facing a challenge with serving a JSON file. I have two main questions regarding this:
- When the JSON file is static, I am struggling to configure Webpack to handle it the same way it handles images. I notice that the URL structure for images is quite complex, such as
, and I would prefer a more straightforward URL for my JSON file.assets/angular.9db278d630f5fabd8e7ba16c2e329a3a.png
- In a more complex scenario, I need to build the JSON file programmatically. While creating the JSON string is not an issue, the problem lies in displaying it. I have looked into examples for displaying a PDF, but they all seem to require a plugin and mainly involve using
window.open
in a new window. Since Angular components are contained within a specific tag on a webpage, I am finding it challenging to break out of this container.
Is this even possible to achieve? I know I presented two questions, but I would appreciate an answer to either one, not necessarily both :)