Meteor UI中的异常:错误:非法HTML属性名称:\

时间:2014-09-15 11:37:35

标签: javascript meteor iron-router

我正在制作Meteor JS应用程序并且我不断收到以下错误:

Exception in Meteor UI: Error: Illegal HTML attribute name: \
    at extendAttrs (http://localhost:3000/packages/htmljs.js?a0a9082010d25b3fb44e0f56bdd0a7b4e6bbeb93:322:13)
    at Object.HTML.evaluateAttributes (http://localhost:3000/packages/htmljs.js?a0a9082010d25b3fb44e0f56bdd0a7b4e6bbeb93:340:3)
    at http://localhost:3000/packages/ui.js?9419ac08328918a04e7a49464a988d45f851e1b0:2536:28
    at _assign._compute (http://localhost:3000/packages/deps.js?4a82362ae66e863a1c1a8b0a5fec6f665e2038d1:228:38)
    at new Deps.Computation (http://localhost:3000/packages/deps.js?4a82362ae66e863a1c1a8b0a5fec6f665e2038d1:160:10)
    at Object._assign.autorun (http://localhost:3000/packages/deps.js?4a82362ae66e863a1c1a8b0a5fec6f665e2038d1:380:13)
    at materialize (http://localhost:3000/packages/ui.js?9419ac08328918a04e7a49464a988d45f851e1b0:2529:27)
    at materialize (http://localhost:3000/packages/ui.js?9419ac08328918a04e7a49464a988d45f851e1b0:2476:7)
    at http://localhost:3000/packages/ui.js?9419ac08328918a04e7a49464a988d45f851e1b0:2393:7
    at Object._assign.nonreactive (http://localhost:3000/packages/deps.js?4a82362ae66e863a1c1a8b0a5fec6f665e2038d1:400:14) 

当我加载名为dialogueIndex的页面时会发生这种情况,该页面列出了Dialogues集合中元素的编辑页面的链接。这是代码:

client/views/dialogue_index.html
================================
<template name="dialogueIndex">
  <main>
    <h1>Dialogues</h1>

    {{#each dialogues}}
    <a href="{{pathFor 'editDialogue'}}">Edit</a> - {{summary}} - "{{text}}"
    <br \>
    {{/each}}
  </main>
</template>


client/js/dialogue_index.js
===========================
Template.dialogueIndex.helpers({
  dialogues:  function() {
                return Dialogues.find({});
              }
});


lib/routes.js
=============
Router.configure({
  layoutTemplate: 'mainLayout',
  loadingTemplate: 'loading'
});

Router.map( function() {
  ...
  this.route('dialogueIndex',     
    {
      waitOn:   function() { return Meteor.subscribe("dialogues"); },
      path: 'dialogue/index'
    });
  this.route('editDialogue',      
    {
      path:     'dialogue/edit/:_id',
      data:     function() { return Dialogues.findOne(this.params._id); }
    });
});

我一直困惑于此,但我不知道这里发生了什么。尝试寻找答案,但我还没有发现这个错误。你能提供的任何帮助都会很棒。

谢谢!

1 个答案:

答案 0 :(得分:1)

<br \>替换为<br>

旁注: 如果你添加<br\>,那么Meteor抛出的错误要精确得多:

Expected "br\" end tag