'How to use environment variables in Angular Elements
I'm working on a client application for my backend that should be provided to the end-users as a standalone, ready-to-use Web Component (so-called widget). For this purpose, I'm using Angular Elements.
The problem is that this widget makes calls to the backend and it requires a username and password for basic authentication. How can I initialize this component platform independently, and securely? @Input() is not an option, because it is not really secure to provide credentials as usual HTML attributes. In a usual Angular project I can use environment files, but what can I use for the generic Web Component?
One more thing - it is not an option to build the component for every user each time, using the environment file. The main idea of this widget is to provide simple and centralized access to a standalone, ready-to-use component that can be used within any framework.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
