I am trying to add a src to a script in my html file, but only if a condition is true. Otherwise it should not have run the script src. Below is my code so far:
<script>
this.booleanValue = JSON.parse(
sessionStorage.getItem("booleanValue")
);
if (this.booleanValue == "true") {
console.log("true");
}
</script>
<script
*ngIf="this.booleanValue != true"
src="code.js"
async
></script>
It console logs the booleanValue as true correctly, however it still runs the script src. It shouldn't because it should only run when false. Does anyone know what I'm doing wrong?
Thanks in advance