[Solved] Angular 5 export html to image


If you want to add url links to images dynamically, here is the code.
You can change the input text event to that HTML link which you want to store.
HTML for module HTML:

<h1>{{title}}</h1>
<div>
        <input type="text" (input)="onInputEvent($event)">
</div>
<div>
    <a [href]='url'>
        <img 
        src="https://stackoverflow.com/questions/51904633/smiley.gif" 
        alt="HTML tutorial" 
        style="width:42px;height:42px;border:0;">
      </a>
</div>

module typeScript:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title="MY TEST";
  url:string ;
  onInputEvent(event:Event){
    this.url=(<HTMLInputElement>event.target).value;
  }
}

solved Angular 5 export html to image