Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如果语句在帕格中不起作用_Node.js_Express_Pug - Fatal编程技术网

Node.js 如果语句在帕格中不起作用

Node.js 如果语句在帕格中不起作用,node.js,express,pug,Node.js,Express,Pug,它一直显示警报。。。除非出现错误,否则我的有什么问题 我的路线 app.set('view engine', 'pug') app.get('/', function (req, res) { res.render('index', { errors: false }) }) 哈巴狗 <!DOCTYPE html> <html lang="nl"> <head> <meta charset="utf-8"> <me

它一直显示警报。。。除非出现错误,否则我的
有什么问题

我的路线

app.set('view engine', 'pug')

app.get('/', function (req, res) {
  res.render('index', { errors: false })
})
哈巴狗

<!DOCTYPE html>
<html lang="nl">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <!--<link rel="icon" href="../../favicon.ico">-->

    <title>Signin Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="signin.css" rel="stylesheet">
  </head>

  <body>

    <div class="container">
      unless errors
        .alert.alert-danger
          <strong>Oh snap!</strong> Change a few things up and try submitting again.

      <form class="form-signin" method="POST" action="/">
        <h2 class="form-signin-heading">Login om verder te gaan</h2>
        <label for="inputEmail" class="sr-only">Email adres</label>
        <input type="email" id="inputEmail" class="form-control" placeholder="Email adres" required autofocus>
        <label for="inputPassword" class="sr-only">Wachtwoord</label>
        <input type="password" id="inputPassword" class="form-control" placeholder="Wachtwoord" required>
        <div class="checkbox">
          <label>
            <input type="checkbox" value="remember-me"> Onthoudt mij
          </label>
        </div>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Login</button>
      </form>

    </div> <!-- /container -->

    <script src="js/ie10-viewport-bug-workaround.js"></script>
  </body>
</html>

引导的登录模板
除非有错误
警觉,警觉,危险
哦,快更改一些内容,然后再次尝试提交。
登录om verder te gaan
电子邮件地址
瓦赫特伍德
昂苏特mij
登录

帕格使用缩进定义标签嵌套,没有任何标签打开或关闭:

doctype default 
html 
    head
        meta(charset="utf-8")
        meta(http-equiv="X-UA-Compatible", content="IE=edge")
        meta(name="viewport", content="width=device-width, initial-scale=1, shrink-to-fit=no")
        //- The above 3 meta tags *must* come first in the head; any other head content must come *after* these

        meta(name="description", content="")
        meta(name="author", content="")

        title Signin Template for Bootstrap
        link(rel="stylesheet", href="/css/bootstrap.min.css")
    body 
        div(class="container")
            - if errors
                .alert.alert-danger
                    strong Oh snap!
                    | Change a few things up and try submitting again.


            form(class="form-signin", method="POST", action="/")
                h2(class="form-signin-heading") Login:
                label(for="inputEmail", class="sr-only") Email address 
                input(type="email", id="inputEmail", class="form-control", placeholder="Email address", required autofocus)
                label(for="inputPassword", class="sr-only") Password
                input(type="password", id="inputPassword", class="form-control", required)
                div(class="checkbox")
然后继续你的模板。

你不是说“如果有错误”吗?如果错误等于false,“除非错误”将返回true,它确实如此。(我不知道帕格,但这似乎是问题所在)