I try to load a js file, which should trigger only in dev mode.
I have this code in my app.component.html
:
<p *ngIf="!environment"> works </p>
<script *ngIf="!environment" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script *ngIf="!environment" src="/src/assets/js/my.js"></script>
environment
is false
.
Note that it works fine for the <p>
tag, but not for the <script>
tags, why?
EDIT
To clarify, the script tags do NOT load, but they should, because environment
is false
. I dont get any errors, nothing. They are simply not there, but the p
tag does load.