title: click event is not working in angular 4 when sending html code from component method
body: <p>If I want to send the data from a method to that html page of the component.<br>
  Please take templateUrl and then in a method send that click  function html code and please tell me how to make it work.<br>
  We must send the html code through a method as shown below.<br>
  Because in my case the code will be changing based on some condition in backend and I am sending that html code through the method.  </p>
  
  <pre><code>test.component.ts
  -----------
  import {Component} from '@angular/core';
  
  @Component({
   selector: 'test',
   templateUrl: `test.html`
  })
  export class TestComponent {
    msg = "";
    clickMsg = "";
    nCnt: number = 0;
  
  
    ngOnInit() {
      this.createMsg();
    }
  
    clickMe() {
        this.nCnt = this.nCnt + 1;
        this.clickMsg = "Clicked: " + this.nCnt;
    }
  
  createMsg(){
   this.msg=`&lt;button (click)="clickMe()"&gt;Click&lt;/button&gt;
      &lt;br/&gt; &lt;p&gt;&lt;strong&gt;{{clickMsg }}&lt;/strong&gt;&lt;/p&gt;`;
  }
  }
  
  test.html
  ----------
  &lt;div&gt; {{ msg }} &lt;/div&gt;
  </code></pre>
  
  <p>This is my requirement and am unable to get that click event.<br>
  Please try the above code and let me know.<br>
  please help me,Waiting for your working demo ansers.  </p>