Sean L
Sean L

Reputation: 827

Meteor Spacebars - Expected identifier, number, string, boolean, or null

I have a function, which if there is one player in a game it returns true

   Template.gamePage.searching = function() {
        var game = GameCollection.findOne({current: true});
        if(game.players.length === 1) {
            return true
        }
    };

I would like to show the below text through spacebars if this searching function returns true:

        {{#if {{searching}}}}
            <h1>Searching for an opponent</h1>
            <div>
            {{> spinner}}
            </div>
        {{/if}}

I get the below error:

client/views/games/game_page.html:35: Expected identifier, number, string, boolean, or null
...>.             {{#if {{searching}}}}     ...

Upvotes: 2

Views: 2175

Answers (2)

Sean L
Sean L

Reputation: 827

This:

 {{#if searching}}
            <h1>Searching for an opponent</h1>
            <div>
              {{> spinner}}
            </div>
 {{/if}}

Upvotes: 0

Arcy
Arcy

Reputation: 375

Try:

{{#if searching}}
      <h1>Searching for an opponent</h1>
      <div>
         {{> spinner}}
      </div>
{{/if}}

Upvotes: 1

Related Questions