简体   繁体   中英

meteor Expected IDENTIFIER error

I'm following the Angular-Meteor framework tutorial ( https://angularjs.meteor.com/tutorial-02/step_14 ) but quite at the end I've experienced an error that I can't get rid of. I've searched for a solution but probably my reduced knowledge of the framework doesn't help me. Compiling the application Meteor shows an Expected IDENTIFIER error (commented line) in the following code:

<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>

This is the compiler output:

=> 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

Seems that some library is missing. Plus if I remove the "template" html tag I obtain a bad formatting html error. Here's the packages list:

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

Any idea? Thanks R.

Looks like you are using an outdated version.

Please look at the code of the tutorial and compare it to yours, there is no need anymore to use the template.

Just use regular Angular code with file ending with .ng.html

Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM