如何在 angular 中调用 jquery 插件函数 5
how to call jquery plugin function in angular 5
我在我的应用程序中使用 jquery 插件 我必须通过 ace.demo.init() 初始化插件
我如何在组件 class 中调用此函数
这是我的代码
import { Component, OnInit } from '@angular/core';
import {NavComponent} from "../../shared/module/navbar/nav/nav.component"
import {FooterComponent} from
"../../shared/module/footer/footer/footer.component"
import {SidebarComponent} from
"../../shared/module/sidebar/sidebar/sidebar.component"
import * as $ from 'jquery';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent implements OnInit {
constructor() { }
ngAfterViewInit() {
this.doJqueryLoad();
}
ngOnInit() {
}
doJqueryLoad() {
console.log("here i want to call")
ace.demo.init() // <==== giving error (cant fine name ace)
}
}
正如@David 所说,我只是如下声明 ace
declare var ace: any;
然后它对我有用
我在我的应用程序中使用 jquery 插件 我必须通过 ace.demo.init() 初始化插件 我如何在组件 class 中调用此函数 这是我的代码
import { Component, OnInit } from '@angular/core';
import {NavComponent} from "../../shared/module/navbar/nav/nav.component"
import {FooterComponent} from
"../../shared/module/footer/footer/footer.component"
import {SidebarComponent} from
"../../shared/module/sidebar/sidebar/sidebar.component"
import * as $ from 'jquery';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent implements OnInit {
constructor() { }
ngAfterViewInit() {
this.doJqueryLoad();
}
ngOnInit() {
}
doJqueryLoad() {
console.log("here i want to call")
ace.demo.init() // <==== giving error (cant fine name ace)
}
}
正如@David 所说,我只是如下声明 ace
declare var ace: any;
然后它对我有用