i have script tags for my payment gateway in my index.html
<script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js"
data-client-key="my-data-client-key">
</script>
my data-client-key
is showing up in head tags, is it okay or should it be secured? if it need to be secured, how can i secure it?
i have read this post How to pass variable data to index.html in angular? but still i wonder is my key should be hidden or not.
and of course i have others key too, like analytics, can i hide it?
EDIT
i added this to my main.ts
if (environment.production) {
enableProdMode();
// HACK: Don't log to console in production environment.
// TODO: This can be done in better way using logger service and logger factory.
if (window) {
window.console.log = window.console.warn = window.console.info = function () {
// Don't log anything.
};
}
document.write('<script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="'+environment.midtransKey+'" ></script>');
} else {
document.write('<script type="text/javascript" src="https://app.sandbox.midtrans.com/snap/snap.js" data-client-key="'+environment.midtransKey+'" ></script>');
}
the script tag for midtrans not showing up, and i got core.js:6014 ERROR ReferenceError: snap is not defined