Javascript code not executing within app.component.html

In my app.component.html I have delcared this code:

<script type="text/javascript">
  console.log('testing console')
</script>

When I load app.component.html the javascript is not executed as the message ‘testing console’ is not printed to the browser console.

I’m using the Angular version:

Angular CLI: 11.2.0
Node: 14.15.5
OS: darwin x64

Angular: 11.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.0
@angular-devkit/build-angular   0.1102.0
@angular-devkit/core            11.2.0
@angular-devkit/schematics      11.2.0
@schematics/angular             11.2.0
@schematics/update              0.1102.0
rxjs                            6.6.3
typescript                      4.1.5

I realise executing javascript code within app.component.html could be bad practice. How/can javascript code be executed within an Angular page ?

128 thoughts on “Javascript code not executing within app.component.html”

  1. Pingback: viagra buy
  2. Pingback: viagra sale
  3. Pingback: cialis 10mg
  4. Pingback: 20mg cialis daily
  5. Pingback: otc viagra
  6. Pingback: viagra
  7. Pingback: viagra online
  8. Pingback: viagra canada
  9. Pingback: online viagra
  10. Pingback: brand cialis
  11. Pingback: low generic viagra
  12. Pingback: sildenafil 50 mg
  13. Pingback: viagra bestellen
  14. Pingback: viagra cock
  15. Pingback: whats viagra
  16. Pingback: visual viagra
  17. Pingback: pfizer viagra
  18. Pingback: sildenafil pills
  19. Pingback: sildenafil price
  20. Pingback: viagra prices