如何使用angular获取id?我不能使用直接方式调用事件因为我不能绑定(点击)事件像角度方式,因为我使用插件。所以我必须努力解决这个事件,但似乎我无法获得id,如果我使用下面的方法,它会说未定义。
ngAfterViewInit() {
let _self = this;
this.datatable.on('m-datatable--on-layout-updated', (event) =>{
$(_self.elRef.nativeElement).find('.deleteFn').click(() => {
var agencyId = $(this).attr("id");//jquery method
console.log(agencyId);
this.router.navigate(['agency/setup']);
});
});
}
答案 0 :(得分:0)
使用ViewChild和elementRef:
DEPRECATED JS - Cookie has been deprecated since 5.8.0 and will be removed in a future release. Use cookie instead.
No stack trace of the deprecated usage is available in your current browser.
Project create didn't get a user META tag, or it had no content. Bailing out
DEPRECATED JS - Dropdown constructor has been deprecated and will be removed in a future release. Use Dropdown2 instead.
No stack trace of the deprecated usage is available in your current browser.
Downloading resources:
Step 1 - Login JIRA
DEPRECATED JS - Cookie has been deprecated since 5.8.0 and will be removed in a future release. Use cookie instead.
No stack trace of the deprecated usage is available in your current browser.
Downloading resources:
DEPRECATED JS - Dropdown constructor has been deprecated and will be removed in a future release. Use Dropdown2 instead.
No stack trace of the deprecated usage is available in your current browser.
AG.LayoutManager.setLayout: Can't manipulate layout. Layout is not writable
Security tokens will be refreshed every 720000ms
DEPRECATED JS - Inline dialog constructor has been deprecated and will be removed in a future release. Use inline dialog 2 instead.
No stack trace of the deprecated usage is available in your current browser.
Downloading resources:
js!/s/d41d8cd98f00b204e9800998ecf8427e-T/bjk90u/72010/b6b48b2829824b869586ac216d119363/7aa44fa9aad9a6239c392b1e7bc884f4/_/download/contextbatch/js/browser-metrics-plugin.co
ntrib,-_super,-atl.dashboard,-atl.general/batch.js?agile_global_admin_condition=true&atlassian.aui.raphael.disabled=true&is-server-instance=true&jag=true&jaguser=true&jcap=
true&nps-not-opted-out=true&sd_operational=true!order
Downloading resources:
css!/s/10d963e1fcee333a7f9aebf08e9b202d-T/bjk90u/72010/b6b48b2829824b869586ac216d119363/329db972cd13259548cc14eada2ef26b/_/download/contextbatch/css/com.atlassian.jira.plug
ins.jira-development-integration-plugin:devstatus-dialog-resources-ctx,-_super,-atl.general,-atl.dashboard/batch.css?agile_global_admin_condition=true&atlassian.aui.raphael
.disabled=true&is-server-instance=true&jag=true&jaguser=true&jcap=true&nps-not-opted-out=true&sd_operational=true
js!/s/a0d3356f3721fb8694c9496f54f4b3ce-T/bjk90u/72010/b6b48b2829824b869586ac216d119363/329db972cd13259548cc14eada2ef26b/_/download/contextbatch/js/com.atlassian.jira.plugin
s.jira-development-integration-plugin:devstatus-dialog-resources-ctx,-_super,-atl.general,-atl.dashboard/batch.js?agile_global_admin_condition=true&atlassian.aui.raphael.di
sabled=true&is-server-instance=true&jag=true&jaguser=true&jcap=true&locale=en-US&nps-not-opted-out=true&sd_operational=true!order
forceLayoutRefresh() is deprecated. Use resize() instead.
forceLayoutRefresh() is deprecated. Use resize() instead.
forceLayoutRefresh() is deprecated. Use resize() instead.
forceLayoutRefresh() is deprecated. Use resize() instead.
Step 2 - Save login page
Stopped here/Didnt go further
答案 1 :(得分:-1)
ngAfterViewInit() {
$(document).on('click', '.deleteFn', ($event) => {
var id = $event.target.id
console.log(agencyId);
this.router.navigate(['agency/setup']);
});
}