Replacement for <%=object%>?

In ye olde days there was the <%=object%> tag in EJS to attach an object to a DOM element in the template, I cannot find the equivalent in stache. Or maybe I’m thinking wrong.

Here’s what I want to establish:

I’ve got a list of objects ‘Attribute’ that should be displayed/behave differently. A_Attribute is a class, B_Attribute is derived from A_Attribute, C_Attribute also, etc.

I was thinking I’d create a different control for every Attribute class:
AAttributeControl = Control.extend({…});
BAttributeControl = AttributeControl.extend({…})

In the overall AttributesControl I want to create a list and attach the correct control to the elements in the list

var attributes = [ new A_Attribute(), new B_Attribute(), new A_Attribute()];

    {{#foreach attributes}}
  • {{name}}
  • {{/foreach}}

and then something like:

$(‘li’).each( (i, elem) => {
var attribute = $(elem).instance(); // <- the old way
// attach the right controller to every li element
new attribute.control( elem ); // <- every attribute its own type controller
});

It’s the data helper in stache. Why are you doing things this way?

ah, thanks. Couldn’t find it in the docs.

I’m trying to find a way to handle classes and subclasses