-1

Can anyone tell me how to accomplish the click event binding to the html which comes as a response from service and then want to append that html to component with the click event.

STF
  • 1,485
  • 3
  • 19
  • 36
Hems
  • 1
  • 4

1 Answers1

0

Same way as you would use in a template inline

(event)="statement".
Piyush.kapoor
  • 6,715
  • 1
  • 21
  • 21
  • Angular bindings are not processed at all in dynamically added HTML. Angular only processes what is statically added to component templates. – Günter Zöchbauer Jun 28 '16 at 07:11
  • can you please suggest me that how can i attach the click event to h1 tag which is coming from service (i.e everytime there will different html will come as a response from service) so i need to find the specific tag from that response and then bind the click event to that. Following is the sample code http://plnkr.co/edit/f4XKhd42OR8TBazKV9ex – Hems Jun 28 '16 at 07:14