流星预期标识符错误

meteor Expected IDENTIFIER error

本文关键字:错误 标识符 流星      更新时间:2023-09-26

我正在学习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

似乎有图书馆不见了。另外,如果我删除"template"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.

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

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

只需使用以.ng.html 结尾的文件的常规Angular代码

祝你好运!