I have written an external JavaScript file for creating dynamic UI on a page. I need to call a function written in component class on click of dynamically created button. Technically I am trying to call a function from plain JavaScript file. Any help will be appreciated.
Below is an example:
Suppose my Home.Component.ts file has a function 'showToast()'
export class HomeComponent {
public showToast() {
this.messageService.showToast();
}
} //end of 'HomeComponent'
and my custom.js file is having a code for finding click event as below:
btn.onClick() {
//I want to call showToast() function from here.
}