jeudi 24 janvier 2019

Opening a div in a and closing it later with meteor/blaze

I'm trying to make something that is not possible in HTML/Blaze only.

By that I mean that I'm trying to open a div in a without closing it in this specific if. Impossible to do it the following way :


    
        <div><p>content</p>
    
    
        </div>
    }


So I found something that could solve this problem. Using triple curly braces and generate the HTML part in JS.


    }


getContent() return my HTML. It looks like this :

getContent(obj) {
    if (obj.level == first)
        return "<div><p>content</p>";
    if (obj.level == last)
        return "<p>content></div>";
    else
        return "<p>content</p>";
}

It works, it render the HTML, but there is one problem. The div I'm opening seems to close itself.

This is what's rendered :

<div><p>Content</p></div>
<p>content</p>
<p>content</p>

instead of :

<div><p>content</p>
     <p>content</p>
     <p>content</p>
</div

I'm really tired, I apologize if I'm not clear enough or if the solution is obvious.

Aucun commentaire:

Enregistrer un commentaire