我在我的应用程序中使用jquery插件我必须通过ace.demo.init()初始化插件 我如何在组件类中调用此函数 这是我的代码
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)
}
}
答案 0 :(得分:0)
正如@David所说,我只是声明ace如下
declare var ace: any;
然后它对我有用