Closed EmilianoBruni closed 6 years ago
Thanks for the pull request!
It's been a long time since I've looked at this library... but it looks like it accepts a DOM element for the template
option. This is a little rigid, as you've found out.
Rather then accept a second option of templateHtml
, how about we allow this.template
to be either a DOM element, or a function. If it's a function, the code will pass the model data to the function, and receive back an HTML string.
I think that will be a more straightforward interface, vs having two possible template
/templateHtml
options. And it will allow the user to use any templating system they want.
Il 15/01/2018 16:56, Edan Schwartz ha scritto:
Thanks for the pull request!
It's been a long time since I've looked at this library... but it looks like it accepts a DOM element for the |template| option. This is a little rigid, as you've found out.
Rather then accept a second option of |templateHtml|, how about we allow |this.template| to be either a DOM element, or a function. If it's a function, the code will pass the model data to the function, and receive back an HTML string.
I think that will be a more straightforward interface, vs having two possible |template|/|templateHtml| options. And it will allow the user to use any templating system they want.
Yes. I think it's better. I'll change my fork with your suggestion.
-- Dott. Bruni Emiliano | info AT ebruni DOT it | http://www.ebruni.it Graduated in Physics | S.I.S.I.T. member #027| Linux Counter #205928 Software developer & Network Administrator | Linux/Windows Specialist R&D manager of Micso S.r.l (Italian I.S.P.) | President of TeLUG
Questa e-mail è stata controllata per individuare virus con Avast antivirus. https://www.avast.com/antivirus
Changed.
Thanks for putting in that work!
Mojolicious uses it’s own embeded Perl parser and the embeded variables look something like this:
<%= $var %>
Underscore uses this as their embeded vars:
<%= var %>
So unless we use a different template engine, we cannot place these underscore templates inline with mojolicious templates because it will try to parse the Javascript template.
So I added a templateHtml to directly set html template in InfoWindow without use of a DOM template in the html file.