1

 @Component({
     selector: 'app-data',
     template: <div><input type="button" (click)="getData();" value="GET DATA"/>    </div> <div id="child">{{data}}</div>
})
vivek k
  • 61
  • 8

1 Answers1

2

You can use the Angular 2 innerHTML binding:

<div [innerHTML]="yourHtmlContentVariable"></div>
Sjors
  • 1,205
  • 1
  • 8
  • 24
  • Hi Sjors, i have to try with http request and render html response that content js or css so how can be do that on button click – vivek k Jun 10 '16 at 11:24
  • If I understand your question correct: you can create a variable for the innerHTML binding, which will be an empty string on init. When your http request has finished, assign the response to that variable – Sjors Jun 10 '16 at 12:05
  • Alright! Can you mark the answer as the solution to your problem? – Sjors Jun 12 '16 at 15:00