@Component({
selector: 'app-data',
template: <div><input type="button" (click)="getData();" value="GET DATA"/> </div> <div id="child">{{data}}</div>
})
-
Welcome to StackOverflow. Please format the code properly. This is unreadable.Günter Zöchbauer– Günter Zöchbauer2016-06-10 10:36:25 +00:00Commented Jun 10, 2016 at 10:36
-
I guess you're looking for stackoverflow.com/questions/36008476/…Günter Zöchbauer– Günter Zöchbauer2016-06-10 10:37:00 +00:00Commented Jun 10, 2016 at 10:37
Add a comment
|
1 Answer
You can use the Angular 2 innerHTML binding:
<div [innerHTML]="yourHtmlContentVariable"></div>
3 Comments
vivek k
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
Sjors
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
Alright! Can you mark the answer as the solution to your problem?