【问题标题】:jQuery in Angular 6 magnificPopup not a functionAngular 6 magnificPopup 中的 jQuery 不是函数
【发布时间】:2018-11-15 14:25:51
【问题描述】:

我正在尝试使用 jQuery ma​​gnificPopup 并在控制台中出现错误。

$(...).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


    【解决方案1】:
    猜你喜欢
    • 1970-01-01
    • 2017-03-06
    • 1970-01-01
    • 1970-01-01
    • 2019-05-27
    • 2019-02-22
    • 2019-06-06
    • 2019-01-13
    • 2018-12-13
    相关资源
    最近更新 更多