方法1:
在需要用到插件的ts文件中添加如下引用
其中 './config/gojs/go.js' 是存放你修改后的go.js路径(为了去水印)
不需要在module里面添加任何东西,也不需要在.angular-cli.json或index.html 配置,这个方法是最简单快捷的。
import { Component , OnInit } from '@angular/core';
import * as go from './config/gojs/go.js';
@Component ({
selector: 'app-gojs-demo',
templateUrl:'./gojs-demo.component.html',
styleUrls: ['./gojs-demo.component.scss']
})
export class GoJSDemoComponent implements OnInit {
ngOnInit(){
this.myGoJS();
}
constructor() {}
myGoJS(){
}
}
其他方法:
方法2:在.angular-cli.json文件中配置
步骤:
1.在项目根目录.angular-cli.json文件中找到script字段,在数组中添加要引用的所有js文件(注意先后顺序)
"scripts": ["assets/jquery-3.2.1.js","assets/jquery.nicescroll.js"