关闭autoform模板时出错

时间:2015-02-11 08:17:19

标签: meteor

我的流星应用程序中有这段代码。 流星版本是:流星1.0.3.1

代码格式符合blaze模板的要求。但我不明白这个问题。

我能够使用autoform的autoform包但不能使用autoform。



<template name="register">
{{> autoForm collection="Users" id="addUserForm" type="insert"}}
<fieldset>
  <legend>Register</legend>
  <div class="form-group">
    <label for="inputFirstName" class="col-lg-2 control-label">First Name</label>
    <div class="col-lg-10">
      {{> afFieldInput name="firstName" class="form-control" id="inputFirstName"}}
    </div>
  </div>
  <div class="form-group">
    <label for="inputLastName" class="col-lg-2 control-label">Last Name</label>
    <div class="col-lg-10">
      <input type="text" class="form-control" id="inputLastName" placeholder="Last Name" />
    </div>
  </div>
  <div class="form-group">
    <label for="inputEmail" class="col-lg-2 control-label">Email</label>
    <div class="col-lg-10">
      <input type="email" class="form-control" id="inputEmail" placeholder="Email" />
    </div>
  </div>
  <div class="form-group">
    <label for="inputPass" class="col-lg-2 control-label">Password</label>
    <div class="col-lg-10">
      <input type="password" class="form-control" id="inputPass" placeholder="Password" />
    </div>
  </div>
  <div class="form-group">
    <label for="inputMobileNum" class="col-lg-2 control-label">Mobile Number</label>
    <div class="col-lg-10">
      <input type="tel" class="form-control" id="inputMobileNum" placeholder="Mobile Number" />
    </div>
  </div>
  <div class="form-group">
    <label for="inputDOB" class="col-lg-2 control-label">Date of Birth</label>
    <div class="col-lg-10">
      <input type="date" class="form-control" id="inputDOB" placeholder="Date of Birth" />
    </div>
  </div>
  <div class="form-group">
    <label for="bgroup" class="col-lg-2 control-label">Blood Group</label>
    <div class="col-lg-10">
      <select class="form-control" id="bgroup">
        <option>A+</option>
        <option>A-</option>
        <option>B+</option>
        <option>B-</option>
        <option>AB+</option>
        <option>AB-</option>
        <option>O+</option>
        <option>O-</option>
      </select>
    </div>
  </div>

  <div class="form-group">
    <label for="country" class="col-lg-2 control-label">Country</label>
    <div class="col-lg-10">
      <select class="form-control" id="country">
        <option>India</option>
      </select>
    </div>
  </div>
  <div class="form-group">
    <label for="state" class="col-lg-2 control-label">State</label>
    <div class="col-lg-10">
      <select class="form-control" id="state">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
      </select>
    </div>
  </div>

  <div class="form-group">
    <label for="city" class="col-lg-2 control-label">City</label>
    <div class="col-lg-10">
      <select class="form-control" id="city">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
      </select>
    </div>
  </div>
</fieldset>
<div class="form-group">
  <div class="col-lg-10 col-lg-offset-2">
    <button type="submit" class="btn btn-primary">Register</button>
  </div>
</div>
{{/autoForm}}
</template>
&#13;
&#13;
&#13;

我收到以下错误:

 While building the application:
 register.html:96: Unexpected closing template tag
 ... </div> {{/autoForm}}

1 个答案:

答案 0 :(得分:1)

查看Spacebars syntax

{{> template ... }}表示将“模板”的内容放在那里。没有结束标签;它只是一个包含的内容。

另一方面,

{{# block ... }}是一个块帮助器,它具有内容和匹配的结束标记{{/block}}。最受欢迎的块助手是each

{{#each players}}
  {{> player}}
{{/each}}

所以你不需要{{/autoform}}