【发布时间】:2016-02-04 00:14:51
【问题描述】:
我正在使用 Jade 构建一个 MEAN 堆栈应用程序,但我的任何脚本标签链接都无法正常工作。链接标签工作正常。我已经尝试过绝对和相对链接,以及关于堆栈溢出问题的其他大约 5 个解决方案(其中大多数是几年前的问题),但它们都没有奏效。
这是我项目中的相关代码:
(header.jade)
link(href='libraries/normalize-css/normalize.css', rel='stylesheet')
link(href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', rel='stylesheet')
link(href='custom.css', rel='stylesheet')
script(src='https://code.angularjs.org/1.4.7/angular.min.js')
script(src='/js/app.js')
(我想使用角度的示例)
extends userBase
block vars
- var title = 'Login'
block body
h1.love love love
div(ng-controller='ChoiceCtrl')
form(method="post", role="form", style="width:90%; margin: 5px auto;", class="form-horizontal")
input(type='hidden', name='_csrf', value=csrfToken)
div.form-group
label(for="question") Ask your question:
input(type="text", name="question", required=true, class="form-control", id="question", placeholder='Which team will win the super bowl this year...?')
br
ul.list-group
li.list-group-item(ng-repeat="choice in choices")
span {{ 2+2 }}
div.form-group
label(for="responses") Choose Response Options:
.input-group
input(type="text", name="response", class="form-control", id="responses", ng-model='choiceBody')
span.input-group-btn
input(type="submit", class='btn btn-primary', value='Add', ng-click='addChoice()')
input(type="submit", class='btn btn-primary', value='Create Poll')
另外,在 server.js 文件中,静态文件的路由工作正常,所以我不确定问题出在哪里。
其余代码在 github 上:https://github.com/gwenf/votenow
【问题讨论】:
-
他们如何“不工作”?您是否在网络面板中为这些脚本获得 404?您可以导航到服务器上脚本的实际位置吗?
-
这是一个状态码 500
-
你的服务器控制台说什么?你得到堆栈跟踪吗? 500 是服务器错误。
-
未捕获的错误:[$injector:modulerr] errors.angularjs.org/1.4.7/$injector/……0d%20(https%3A%2F%2Fcode.angularjs.org%2F1.4.7%2Fangular.min.js%3A19%3A463 ) createPoll:7
标签: node.js pug mean script-tag