Linked Questions
163 questions linked to/from Angular HTML binding
354
votes
1
answer
353k
views
How to render string with html tags in Angular 4+? [duplicate]
In my angular 4 app, I have a string like
comment: string;
comment = "<p><em><strong>abc</strong></em></p>";
When I serve this text in my html, like
{{comment}}
...
102
votes
1
answer
114k
views
How to bind raw html in Angular2 [duplicate]
I use Angular 2.0.0-beta.0 and I want to create and bind some simple HTML directly. Is is possible and how?
I tried to use
{{myField}}
but the text in myField will get escaped.
For Angular 1.x i ...
107
votes
1
answer
78k
views
Angular 2: How do you render HTML from a JSON response without displaying the tags to the user? [duplicate]
Edit: a clarification for anyone who only skimmed the title, my question is about Angular 2, not 1.
I have a component template that is something like this:
<div>{{ post.body }}</div>
The ...
33
votes
2
answers
120k
views
How to get angular2 [innerHtml] to work [duplicate]
I don't know what am doing wrong as no errors are report.
I have a component class
import { Component, OnInit, ViewContainerRef } from '@angular/core';
@Component({
selector: 'app-root',
...
28
votes
1
answer
42k
views
Sanitize input in Angular2 [duplicate]
I am trying to get third-party (potentially unsafe) html content from my database and insert it into my html document.
How do I safely do that (Protection against XSS) ?
In Angular1.x there used ...
20
votes
1
answer
35k
views
How to bind html into Angular 2.0 [duplicate]
In angular 1 binding works like ng-bind-html="htmlValue"
How to bind html in Angular 2.0
17
votes
1
answer
17k
views
Angular 2 return html instead of string [duplicate]
Let's assume I have a test property like that:
export class SomeComponent implements OnInit {
testing = '<strong>Just testing</strong>';
}
And I add to my test.component.html this ...
0
votes
2
answers
8k
views
Print html content in Ionic2 page [duplicate]
I have a ionic2 page and i want to print HTML inside the ion-item:
Here is the ionic2 page:
@Page({
templateUrl: './html-page.html',
})
export class Demo{
htmlString:string = "Hello<br/&...
12
votes
2
answers
17k
views
Inserting HTML from server into DOM with angular2 (general DOM manipulation in Angular2) [duplicate]
I would like to insert some HTML that I retrieve from my server into a DOM element in angular2. I can't seem to figure out the best/correct way to do this.
I can't just put {{my_data}} into a ...
7
votes
2
answers
8k
views
innerHTML is not working for some tags like button or custom tags [duplicate]
Problem in interpolation when I assign some html tags(like button) or custom tag by angular interpolation then its not showing
In component.html file
<div [innerHTML]="html"></div>
In ...
5
votes
1
answer
8k
views
Angular2: How to display data in html format in angular2 data binding? [duplicate]
I have product data from database contains title, description...
The description is in html format string, like this:
<b>Name:</b> iPhone 5;<br>
<b>Membery:</b> 8GB;<...
4
votes
1
answer
8k
views
Pass HTML into Mat Dialog [duplicate]
I am trying to pass HTML into my Mat Dialog code as the message parameter. So I have the following but am not sure how I can pass HTML into it.
openAlertDialog() {
const dialogRef = this.dialog....
2
votes
3
answers
13k
views
Get an html code from string and display it in angular [duplicate]
I have the body of an email stored in a javascript/typescript string (message.body). The content of that string is an html code like this:
<div dir="ltr">test mail</div>
I'm ...
4
votes
1
answer
7k
views
angular 2 [innerHTML] render inside html (not working on angular 2 ) [duplicate]
i am using Angular 2 and i try to render the text which i have inside the variable action.render as html code:
<p *ngIf="action.isHtml">
<div [innerHTML]="{{action.content}}"></...
1
vote
1
answer
6k
views
Ionic - Rendering html content [duplicate]
I just wanna know how can I render html content on an Ionic application taking the content from a property of the relative class.
For example, I have the following two files...
home.ts
import { ...