【发布时间】:2019-01-11 13:48:12
【问题描述】:
我在 Angular 7 项目中添加了 jquery 和 jquery 第三方插件“stiffChart”。我已经在我的项目中安装了 jquery 和插件。在 angular.json 文件中声明相同但在调用插件方法时出现以下错误。
错误:[ts] 类型“JQuery”上不存在属性“stiffChart”
我的代码:
import { Component, OnInit } from '@angular/core';
import * as $ from'jquery';
interface JQuery { stiffChart(options?: any): any; }
@Component({
selector: 'app-demo', templateUrl: './demo.component.html',
styleUrls: ['./demo.component.css'] })
export class DemoComponent implements OnInit {
constructor() { }
ngOnInit() {
$('#your-chart-name').stiffChart({});
}}
请让我知道我在这里做错了什么。
【问题讨论】:
-
请提及反对反对票的观点..
-
嗨,你解决了这个问题吗?我也遇到了同样的问题
标签: jquery angular jquery-plugins angular7