Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template expression not rendering, if its name is a variable #26

Closed
rab1 opened this issue Oct 23, 2016 · 3 comments
Closed

Template expression not rendering, if its name is a variable #26

rab1 opened this issue Oct 23, 2016 · 3 comments

Comments

@rab1
Copy link
Contributor

rab1 commented Oct 23, 2016

The following code expected to render, template person-template like knockout templating, but its gives an error.

var html = `<!-- ko template: { name: tpl, data: buyer } --><!-- /ko -->'
    <!-- ko template: { name: tpl, foreach: [buyer] } --><!-- /ko -->`;

var cfg = {
    templates: {
        "person-template": `<h3 data-bind="text: name"></h3>
            <p>Credits: <span data-bind="text: credits"></span></p>`
    }
};

var outputHtml = (new Htmlizer(html, cfg)).toString({
        tpl: "person-template",
        buyer: {
            name: 'Franklin',
            credits: 250
        }
    });
@Munawwar
Copy link
Owner

@rab1 Added support for variable as template name on v2.6.0.

@Munawwar
Copy link
Owner

@rab1 I added a test for it on v2.6.1.

@rab1
Copy link
Contributor Author

rab1 commented Oct 24, 2016

@Munawwar Great job !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants