【发布时间】:2018-11-15 14:25:51
【问题描述】:
我正在尝试使用 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
});
}
}
【问题讨论】:
标签: jquery angular6 magnific-popup