What is the best approach for passing settings to an AngularJS app?
Technology stack:
- Node.js
- AngularJS
Example of how settings might look:
window.settings = {};
settings.webSocketURL = 'ws://domain.com/websocket';
settings.webSocketTopic = 'name';
Here are a few different options to consider:
Include the script
<script src="scripts/settings.js"></script>
Disadvantages: The settings.js file is in the scripts directory rather than the root directory, and it requires an additional script load.
Include the script as in option 1, but have settings.js generated by Node.js.
Disadvantage: Requires an additional script load.
Embed the settings directly into the HTML.
Disadvantage: Requires the use of templating like EJS instead of pure HTML.