我正在尝试在我的Jade模板中使用Angular的ng-include来包含一个标题:
:
doctype html
html(lang="en")
head
meta(charset='UTF-8')
meta(name='fragment', content='!')
base(href='/')
title Node Express Angular
link(rel='stylesheet', href='//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css')
link(rel='stylesheet', href='/css/syle.css')
body(ng-app='myApp')
ng-include(src='\'/partials/header.jade\'')
div.container
div.jumbotron.text-center
h1 Home Page
p This page is a draft in progress
script(src='//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.15/angular.min.js')
script(src='//cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.8/angular-ui-router.min.js')
script(src='/js/app.js')
The text in header.jade is the following:
nav.navbar.navbar-inverse(role='navigation')
ul.nav.navbar-nav.navbar-header
li
a(src='/home', class='navbar-brand') Home
li
a(src='/about') About
li
a(src='/login') Login
li
a(src='/register') Register
我尝试了ng-include(src='\'/partials/header.jade\'')
和div(ng-include='\'/partials/header.jade\'')
在Chrome开发者控制台中,第一个结果为<!--ng-Include: undefined -->
,第二个结果为:<!-- ng-Include: '/partials/header.jade' -->
有什么线索吗?
ng-include
时遇到的作用域问题。 - Jason Swett