Я не могу отобразить Jade внутри ng-view. Вне ng-view рендеринг jade работает так, как и ожидалось.
Я предполагаю, что мне нужно добавить новый маршрут для отображения содержимого home.jade, но это, похоже, не работает.
Есть ли у вас какие-либо предложения по устранению этой проблемы?
Экспресс-маршрутизация
router.route('/')
.get(function(req, res) {
res.render(path.join(__dirname, '../views/', 'index'));
// res.render(path.join(__dirname, '../views/partials', 'home'));
});
layout.jade
doctype html
html(ng-app="myapp", lang="nl")
head
meta(charset="utf-8")
meta(name="viewport", content="width=device-width, initial-scale=1")
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css')
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css')
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css')
title MyApp
body
block content
script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.js')
script(src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.js')
script(src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js")
script(src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.4/angular-route.js")
script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js')
script(src='/javascripts/app.js')
script(src='/javascripts/my.js')
index.jade
extends layout
block content
div#wrapper.container-fluid
div#header.row-fluid
h1 Document Heading
div#nav.row-fluid
ul.nav.nav-pills#top-nav
li(role='presentation')
a(href='/') Home
li(role='presentation')
a(href='/about') About
li(role='presentation')
a(href='/api-tester') API-tester
div.row-fluid
div#sidebar.col-md-2.hidden-xs
h2 Column 2
p Lorem ipsum dolor sit amet
ul.nav.nav-pills.nav-stacked
li(role='presentation')
a(href='#') Link1
li(role='presentation')
a(href='#') Link2
div#main.col-md-10(ng-view)
div#footer.row-fluid
p Footer
partials/home.jade --> не отображается
h1 Home
Результат:
ИЗМЕНИТЬ:
Я добавил новый маршрут, но он все еще не отображается
router.route('/partials/:name')
.get(function (req, res) {
var name = req.params.name;
res.render(path.join(__dirname, '../views/partials/', name));
}
);