jquery - Angular 6 magnificPopup 中的 jQuery 不是函数
问题描述
我正在尝试使用 jQuery magnificPopup并在控制台中出现错误。
$(...).magnificPopup 不是函数
我包括这个:
“脚本”:[“../node_modules/jquery/dist/jquery.min.js”]
在 angular.json 文件中,我的控制器如下所示:
import {Component, AfterViewInit} from '@angular/core';
declare var $: any;
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.less'],
})
export class HeaderComponent implements AfterViewInit {
constructor() {
}
ngAfterViewInit() {
debugger;
$('#inline-popups').magnificPopup({ // says magnificPopup is not a function
delegate: 'a',
removalDelay: 500,
callbacks: {
beforeOpen: function() {
this.st.mainClass = this.st.el.attr('data-effect');
}
},
midClick: true
});
}
}
解决方案
推荐阅读
- excel - Copy and Paste Cell Values in Excel VBA: Compile and Run Time Errors
- python - 有没有办法判断列表的某个元素是否存在?
- c++ - 从向量的向量中删除向量的组合
- hadoop - 在 oozie 工作流中指定作业队列名称的正确方法
- haskell - 过滤字符串列表列表,得到一定长度的字符串列表列表
- google-apps-script - 列出谷歌表格脚本中的所有文件夹和子文件夹
- r - 带有外来字符的 R 文档
- c - c : 如何从其他数组初始化多维数组?
- python - 打印在同一行 CMD
- ms-word - 错误 - applescript 中的“未授权将 Apple 事件发送到 Microsoft Word”