can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
32 lines (23 loc) • 749 B
HTML
<script type='text/stache' id='demo-html'>
<pre>url={{ routeUrl(undefined,true) }}</pre>
<a {{^ routeCurrent(page='home') }}
href="{{ routeUrl(page='home') }}"
{{/ routeCurrent }}
>home</a>
<a {{^ routeCurrent page='restaurants' }}
href="{{ routeUrl(page='restaurants') }}"
{{/ routeCurrent }}
>restaurants</a>
{{# eq(page, 'home') }}
<h1>Home page</h1>
{{ else }}
<h1>Restaurants page</h1>
{{/ eq }}
</script>
<script src="../../node_modules/steal/steal.js" dev-bundle main="@empty" id='demo-source'>
import { DefineMap, route, stache, stacheRouteHelpers } from "can";
const template = stache.from('demo-html');
route.register('{page}',{page: 'home'});
route.start();
document.body.appendChild( template(route.data) );
</script>