meteor预计IDENTIFIER错误

时间:2015-03-01 15:15:06

标签: javascript angularjs meteor

我遵循Angular-Meteor框架教程(https://angularjs.meteor.com/tutorial-02/step_14),但最后我经历了一个我无法摆脱的错误。 我已经搜索过一个解决方案了,但是我对框架知识的了解可能对我没有帮助。 编译应用程序Meteor在以下代码中显示了预期的IDENTIFIER错误(注释行):

<template name="parties-list">
<form>
    <label>Name</label>
    <input ng-model="newParty.name">
    <label>Description</label>
    <input ng-model="newParty.description">
    <label>Public</label>
    <input type="checkbox" ng-model="newParty.public">
    <button ng-click="newParty.owner=$root.currentUser._id;parties.push(newParty); newParty='';">Add</button>
</form>
<ul>
    <h1>Parties:</h1>
    <div>
        <input type="search" ng-model="search" placeholder="Search">
        <select ng-model="orderProperty">
            <option value="1">Ascending</option>
            <option value="-1">Descending</option>
        </select>
    </div>
    <li dir-paginate="party in parties | itemsPerPage: perPage" total-items="partiesCount.count">
        <a href="/parties/{{party._id}}">{{party.name}}</a>
        <p>{{party.description}}</p>
        <button ng-click="remove(party)">X</button>

        <div>
            <input type="button" value="I'm going!" ng-click="rsvp(party._id, 'yes')">
            <input type="button" value="Maybe" ng-click="rsvp(party._id, 'maybe')">
            <input type="button" value="No" ng-click="rsvp(party._id, 'no')">
        </div>
        <div>
            Who is coming:
            Yes - {{ (party.rsvps | filter:{rsvp:'yes'}).length }} // Error line
            Maybe - {{ (party.rsvps | filter:{rsvp:'maybe'}).length }}
            No - {{ (party.rsvps | filter:{rsvp:'no'}).length }}
            <div ng-repeat="rsvp in party.rsvps | filter:{rsvp:'yes'}">
                {{ getUserById(rsvp.user) | displayName }} - {{ rsvp.rsvp }}
            </div>
            <div ng-repeat="rsvp in party.rsvps | filter:{rsvp:'maybe'}">
                {{ getUserById(rsvp.user) | displayName }} - {{ rsvp.rsvp }}
            </div>
            <div ng-repeat="rsvp in party.rsvps | filter:{rsvp:'no'}">
                {{ getUserById(rsvp.user) | displayName }} - {{ rsvp.rsvp }}
            </div>
        </div>
        <ul>
            Users who not responded:
            <li ng-repeat="invitedUser in outstandingInvitations(party)">
                {{ invitedUser | displayName }}
            </li>
        </ul>

        <p><small>Posted by {{ creator(party) | displayName }}</small></p>
    </li>
</ul>
<dir-pagination-controls on-page-change="pageChanged(newPageNumber)"></dir-pagination-controls>
</template>

这是编译器输出:

=> Started proxy.                             
=> Started MongoDB.                           
=> Errors prevented startup:                  

   While building the application:
   client/parties/views/parties-list.ng.html:32: Expected IDENTIFIER
   ...            Yes - {{ (party.rsvps | filte...
   ^
   client/parties/views/party-details.ng.html:2: bad formatting in HTML
   template

似乎缺少一些图书馆。 如果我删除&#34;模板&#34; html标签我得到一个错误的格式化html错误。 这是包裹清单:

meteor-platform
urigo:angular
angularui:angular-ui-router
accounts-ui
accounts-password
accounts-facebook
accounts-twitter
urigo:angular-utils-pagination
tmeasday:publish-counts
email

有什么想法吗? 谢谢 R上。

1 个答案:

答案 0 :(得分:0)

看起来您使用的是过时的版本。

请查看教程的代码并将其与您的代码进行比较,不再需要使用该模板。

只需使用带有以.ng.html

结尾的文件的常规Angular代码 祝你好运!