I get given a JSON file and within that there is a property called html
and this property looks like:
[
{
"id":"1",
"question": "Who is reporting the claim?",
"html": "<input type='text' [value]='text'>"
}
]
I get the JSON and in the component I have a variable called html
which is like below:
export class AppComponent implements OnInit {
html: string;
text: string;
}
On the ngInit
function, I get the JSON and set the html
variable to the HTML in the file.
ngOnInit() {
this._appService.getQuestions().subscribe(response => {
this.html = response[0].html;
});
}
This then binds to the view like so:
<div class="row" [innerHTML]='html | safeHtml'></div>
Now my question is the Input that was generated through the JSON file, how do I bind the value of that to text? As the current implementation does not work.