Angulardart show HTML String - html

This question is probably really stupid but i really searched a lot for it, but I may be using the wrong keywords.
I have a String with <hr> and I want Angular to display a horizontal line.
The HTML is converted to <hr> and therefore displayed as text <hr> on the page.
How can I achieve this that the HTML tags are not converted by angular?
I have done this in Angular 6 with TS and there it was no problem, is there a pipe or something else, which I have to use?

Binding to [innerHtml] should do that.
<div [innerHtml]="fieldInComponentClassWithHtml"

You need to use SafeInnerHtmlDirective
https://pub.dev/documentation/angular/latest/angular.security/SafeInnerHtmlDirective-class.html

Related

Jade with Fluidtypo3 (custom syntax)

I am developing Typo3 websites using Fluidtypo3.
Now as fluid has its own syntax with custom elements like:
<flux:field.inline.fal name="image" label="Image" allowedExtensions="gif,jpg,jpeg,png" maxItems="1" />
I am running into a conflict, when I want to work with jade, because when I convert this html into jade it looks like:
flux:field.inline.fal(name="image" label="Image" allowedExtensions="gif,jpg,jpeg,png" maxItems="1")
which will be converted by jade to:
<flux:field name="image" label="Image" allowedExtensions="gif,jpg,jpeg,png" maxItems="1" class="inline fal"></flux:field>
As you can see jade parses the dots from flux:field.inline.fal as classes.
My question is, if I it's possible to extend jade to ignore all dots on specific elements like: flux:*. If not, then it's possible to escape that dots, so that they will be appended to the elements decleration.
Thanks for your help!
I found a solution for my problem:
#{'flux:field.inline.fal'}
will be converted to:
<flux:field.inline.fal>
And if you want to add classes just put them after the closing bracket:
#{'flux:field.inline.fal'}.myClass
I hope that will help anyone who runs into the same problem.

Trying to convert plain textarea input into somewhat formatted newlines

Here's an example of what I'm inputting into my creation form:
I'd like to somehow convert that input into actual HTML when rendering in my view like:
<p>+65 Magical Power</p>
<p>+75 Mana</p>
<p>+10 MP5</p>
I tried to create a helper method in the Item class. But it seems I cannot use the content_tag method in the Models or Controllers.
What would be a good way to solve this problem?
I think <xmp></xmp> can be used. I tried using it with simple <p> </p> tag but did not try echoing the input field.

Pagebreak to contain read more link

I'm currently trying to figure out how to make a page break set of html convert into a read more link.
<div style="page-break-after: always;">
<span style="display: none;"> </span></div>
I've seen something similar in WordPress that makes the content past the line break not appear on the page. Does anyone know how to do this ?
If you're using a WYSIWYG editor such as tinyMCE, you can use the horizontal line as a separator for example.
Then, using php, you do an explode using the html code of your separator and you display only the first value of your array as an introduction text.
That's how i do it, there might be better ways.

Insert HTML markup using Meteor

How can I display marked up string data in a Meteor template?
I need to display a string from my database that contains some basic HTML tags such that the resulting text is properly formatted. It currently just displays the markup text.
Here's the relevant part of the template:
<span class="description">{{description}}</span>
Where {{description}} is the string containing markup (like "hello<br>world").
I'd like it to display
hello
world
rather than
hello<br>world
I guess this would be similar to using innerHTML in javascript.
Thanks in advance!
To override HTML-escape in Handlebars, use the triple-stash:
<span class="description">{{{description}}}</span>

How can I escape a sequence of HTML so it can go inside a tags title attribute?

I've been working on this for way too long. I'm trying to put HTML inside the title attribute of a tag. This is for a tooltip. Of course, if this is going to be possible, then I have to escape all of the necessary characters so it doesn't screw up the tag in which it is contained. To be specific, how can I fit the following inside the title attribute of a tag:
test
That is, I want this:
<div title="test">my div</div>
I feel like I've tried everything. Is this even possible?
I googled HTML Escape Characters and found a tool to do it: http://accessify.com/tools-and-wizards/developer-tools/quick-escape/default.php
It produced this string which you can use:
<a href="test">test</a>
if you are using jquery you can do it like this
$('div').attr('title','test');
if you want to escape html tags then you simply can do this
if your test is in a div something like this
<div id="tag">test</div>
then you can do $('div').attr('title', $("#tag").text());