Reputation: 3336
Well, i have a template with some javascript files declared in bottom of index.html and some CSS in top. Like jQuery, Datatable, Select2 and more.
I know that Angular don't know how to manage it because are out yours boundaries. In a file javascript called main.js i have the following:
$("#someintput").val("hi world");
$("#datatable#").Datatable();
This works sometimes. Datatable is rendered sometimes, but sometimes not. Angular intefere in this process ? What is the correct way to make angular work this javascript and css files from template ?
Upvotes: 1
Views: 571
Reputation: 3177
You must tell the CLI that you want to use these files, open the angular-cli.json
or angular.json
(newest Angular version) file and look for the apps.styles and apps.scripts section
"styles": [
"styles.css"
],
"scripts": [],
then you need to modify it to look like this:
"styles": [
"path/to/your/css/here.css",
"another.css"
],
"scripts": [
"path/to/your/js/here.js",
"another.js"
],
I hope that this will help you
Any CSS files you want to add that you won’t be referencing from your modules directly, and any javascript files that you won’t be importing into your TypeScript files. When you compile, they become part of the bundles.
Upvotes: 2