Bmo*_*moe 1 javascript angular
In Angular 8, I am importing bootstrap css files into my styles.css file like so:
/* You can add global styles to this file, and also import other style files */
@import "~bootstrap/dist/css/bootstrap.min.css";
@import "~font-awesome/css/font-awesome.min.css";
Run Code Online (Sandbox Code Playgroud)
However I have a js file called main.js and I want to do the same for the js dependencies but the browser says there is a syntax error on line 1. main.js looks like this:
@import "~jquery/dist/jquery.slim.min.js";
@import "~popper.js/dist/popper.min.js";
@import "~bootstrap/dist/js/bootstrap.min.js";
Run Code Online (Sandbox Code Playgroud)
And then I plan on just using main.js in the scripts section of angular.json. How do I do imports of javascript files into another javascript file with the @import statement?
You should put the global scripts in your angular.json, property "scripts".
"scripts": [
{
"input": "node_modules/jquery/dist/jquery.min.js"
},
{
"input": "node_modules/bootstrap/dist/js/bootstrap.min.js"
}]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
47 次 |
| 最近记录: |