xwoker
xwoker

Reputation: 3171

How do I deliver static html pages with vaadin router (client side)?

vaadin-router is a small client side javascript router. How do I deliver an arbitrary number of static html pages?

Upvotes: 1

Views: 247

Answers (1)

xwoker
xwoker

Reputation: 3171

The demo contains an example how to add router-ignore as an attribute to an link

<a href="/users" router-ignore>Users</a>

and an example how to do deliver all files matching a specific pass as an special route

// this would be the first route in the router config:
var specialRoute = 
    {
        path: '/external/(.*)',
        action: (ctx, commands) => {
        window.location.pathname = ctx.pathname;
    }
 };

So to deliver all html files via router we can use:

var routeStaticHtmlFiles = 
{
    path: '(.*)\.html',
    action: (ctx, commands) => {
        window.location.pathname = ctx.pathname;
    }
}

Upvotes: 1

Related Questions