I’ve recently started learning Angular and I’ve encountered an issue that I’m not sure how to solve. My scripts aren’t loading.
I’ve tried including them in the index.html file, but nothing happens – it doesn’t even display any errors in the console. I also attempted to add them in the angular.json file, but the issue still persists.
2
Answers
Angular is not like a traditional webpage or JS library. You cannot just link scripts. They must be imported.
You also should not be using any scripts (like bootstrap for example) that will manipulate the DOM. Angular needs full control of your application and it needs to know about any DOM changes. You need to do things "the angular way" and use Angular libraries or custom components.
To give you an example, instead of the plain JS script that does Bootstrap stuff you should probably use one of these instead: