Ionic5 with angular with dynamic hypderlinks

Hello all,

I need to know how to call angular method from dynamic hyper links? my code is:

model1:
HTML code - generated dynamically from back-end

<a class="linkref" href="" (click)="showfootercited()"><font color="blue">my text</font></a>

angular

ngOnInit(){
showfootercited(event: any){
//here my action
}

The above function showfootercited which is not triggered when i click the link from my mobile device? so i tried the following model2 that is also not giving expected result.

model2:

<a [routerLink]="judgement-content;caseid_param=129807;content_param=id2">Link</a>

This is also does nothing

Hi gopalan, welcome to our community!

Which data do you actually need dynamically? Just some HTML and a few URL parameters? Trying to dynamically generate Angular components is a lot more work since you’ll need to bundle the Angular compiler and use it at runtime. You’re also introducing security risks. Also consider Markdown rather than HTML because of this very reason.

First of all thanks for the immediate response, and hope you are all doing fine there.

Yes i mean the HTML data rendering into div component is dynamic, here my code binding HTML data to the element

My HTML data looks like:

<a class=“linkref” (click)=“myfootercited(id)”>2019 2 MWN (Cr.) DCC 145

If you insist, then you need the Compiler at runtime. Import @angular/compiler in main.ts then find resources explaining these methods https://angular.io/api/core/Compiler#compileModuleAndAllComponentsSync

@m.koretskyi do you have any in store?