Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The {0} {1} {2} his {3} off
- <div *ngFor="let question of questionsArray">
- ---- some stuff ----
- <div [innerHTML]="createQuestion(question)"></div>
- ---- some stuff ----
- </div>
- createQuestion(question: string): SafeHtml {
- let innerHtml = '';
- let words = question.split(' ');
- for (let index = 0; index < words.length; index++) {
- const element = words[index];
- if (element.indexOf('{') >= 0) {
- innerHtml += '<input type="text" name="test"></input>';
- } else {
- innerHtml += element;
- }
- }
- return this.sanitizer.bypassSecurityTrustHtml(innerHtml);
- }
- constructor(private sanitizer: DomSanitizer) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement