@Component({
selector: 'app-data',
template: <div><input type="button" (click)="getData();" value="GET DATA"/> </div> <div id="child">{{data}}</div>
})
Asked
Active
Viewed 1,856 times
1

vivek k
- 61
- 8
-
Welcome to StackOverflow. Please format the code properly. This is unreadable. – Günter Zöchbauer Jun 10 '16 at 10:36
-
I guess you're looking for http://stackoverflow.com/questions/36008476/how-to-realize-website-with-hundreds-of-pages-in-angular2 – Günter Zöchbauer Jun 10 '16 at 10:37
1 Answers
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
-