我想将 jira 问题收集器与一个有角度的应用程序集成
我试过类似的东西
组件.ts
import { Component, OnInit } from '@angular/core';
import * as jQuery from 'jquery';
declare global {
interface Window { ATL_JQ_PAGE_PROPS: any; }
}
window.ATL_JQ_PAGE_PROPS = window.ATL_JQ_PAGE_PROPS || {};
@Component({
selector: 'cmdb-jira-issue-collector',
templateUrl: './jira-issue-collector.component.html',
styleUrls: ['./jira-issue-collector.component.scss']
})
export class JiraIssueCollectorComponent implements OnInit {
constructor() { }
ngOnInit() {
}
submitIssue() {
console.log('submitIssue');
jQuery.ajax({
url: "my-url",
type: 'get',
cache: true,
dataType: 'script'
});
window.ATL_JQ_PAGE_PROPS = {
"triggerFunction": function(showCollectorDialog) {
showCollectorDialog();
}
};
}
}
Component.html
<p>jira-issue-collector works!</p>
<button id (click)="submitIssue()" id="submit">Submit Issue</button>
但是这不起作用。
还尝试将脚本直接注入 index.html 中,如Ways to integrate the Jira issue collector with an Angular app? but
i get error that window.showCollectorDialog is not a function
and ReferenceError: jQuery is not defined
.
我很困惑。我错过了什么?