Configuration
The configuration variables related to your app are stored inside /assets/custom/js/config.js file.
You can store configuration variables such as API keys related to third-party services inside this file.
The example structure of storing variables is —
1
window.config.facebook {
2
appId: '12345679098765431'
3
}
Copied!
You can access these variables from inside JavaScript or from inside the HTML template.
1
// Accessing from inside JavaScript
2
console.log(window.config.facebook.appId);
3
// Or you can also access this way, once your app is initialized.
4
console.log(app.data.config.facebook.appId); // This is the recommended way
Copied!
1
<!-- Accessing from inside HTML template -->
2
<template>
3
<div>{{$root.config.facebook.appId}}</div> <!-- After parsing, the output will be 12345679098765431 -->
4
</template>
Copied!
Last modified 2yr ago
Copy link