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

[question] How to use vash.helpers.include #126

Open
Jan-H-Hu opened this issue Jun 8, 2018 · 1 comment
Open

[question] How to use vash.helpers.include #126

Jan-H-Hu opened this issue Jun 8, 2018 · 1 comment

Comments

@Jan-H-Hu
Copy link

Jan-H-Hu commented Jun 8, 2018

Hello Together

First of all many thanks for Razor Views under Javascript.

I have a question about vash.helpers.include I'm not quite sure how the method is used.
I work with Nodejs 8.x, express 4.18, Typescript and vash 0.12.4.

Now you would like to include a "Partial View" in a page.
I heard it from Razor:

@await Html.PartialAsync("PartialName", Data)

I think the method "vash.helpers.include" unfortunately does not work.

Can somebody help me? What's missing?

index.ts

router.get('/', async (req: express.Request, res: express.Response) => {
    try {
        res.render('index', {
            title: 'Index',
            authentication: res.locals,
        });
    } catch (e) {

    }
});

Index.vash

@html.extend('layout', function(model){

    @html.block('content', function(model){

        @vash.helpers.include('test', null);

    })
})

Test.vash (PartialView)

<div class="container">
    <div class="row">
        <div class="col-sm-12">
            <h2>Test</h2>
        </div>
    </div>
</div>

Best Regards

Jan

Edit:
Sorry my mistake : => @html.include('Test', null);

@kirbysayshi
Copy link
Owner

I haven't tested vash with a recent version of express. When you run your code, are you seeing anything odd in your output? Such as [VASHMARK- ? If so, the issue is probably this one: #35 (comment)

Basically, a function must be called to signal to vash that rendering has finished.

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