node.js - Partial Load in express and pug without reloading the layout.pug -
is possible layout.pug not refreshing on page switch example /page1 or /page2 ?
layout.pug:
doctype html html head title pug example meta(name="viewport" content="width=device-width, initial-scale=1") script(src="/js/vendor/jquery.min.js") body div.container h1#test= 0 script. var count = 0; setinterval(function() { count++; $('#test').text(count); console.log(count); },1000); block content
page1.pug:
extends layout block content .row .col-md-8 p page 1 a(href='/test2') link
page2.pug:
extends layout block content .row .col-md-8 p page 2 a(href='/test1') link
on every switch /page1 or /page2 script should not reset , content should rendered.
express:
app.get('/page1', function(req, res) { res.render('page1', { user: req.user }) }); app.get('/page2', function(req, res) { res.render('page2', { user: req.user }) });
is possible express , pug atleast or need additional packages??
Comments
Post a Comment