How to include external css and js file in angular 6 / Angular 7

Posted at: December 3, 2018 4:25 PM

You can include css and js file in your angular project using npm command or direct insert link into src/index.html. I have described both options. I have taken example of Materialize css.

Option 1

Install Materialize css using npm command.

open angular.json and your css file path in styles: ["node_modules/materialize-css/dist/css/materialize.min.css"] and js file path "scripts": ["node_modules/materialize-css/dist/js/materialize.min.js"]. For detail see below code.


Option 2

You can add direct link into src/index.html file

Open src/index.html file and insert css file path into head tag and js file path insert into bottom before closing body tag. For detail see below code.


Include External CSS Include External JS

Please leave comments

Speed Up Your Magento Store by 300%

Angular Templates

React Templates

Magento 2 Templates

truecodex launched free android app. You can download and install truecodex app on your mobile and get notification of the latest post.

Video Tutorials on YouTube