0
votes

I'm trying to implement my own tabs, each tab has his own content. The default selected tab is the tab 1. It loads the html content and the template just fine. When I try to switch to the other two tabs I get the following error message:

Error: Expected template or null, found: false

In this case the template rendered in the tab 1 is the same rendered in the tab 3. In the tab 1 works fine, in the tab 3 i get the error message.

{{#if isSeletedTab 1}}
  <div class="col-sm-12  horizontal-list">
    <div class="new-store-card">
      <img src='./img/add.png' />
      <br/>
      <span class="new-store-text">Add a new</span>
      <br/>
      <span class="new-store-text">store</span>
    </div>
  {{#each store in stores}}
      <div class="store-card-container">
        {{#if isSelectedStore store.name}}
        <div class="edit-store-button">
          <img src="./img/edit.png" class="edit-store-button-icon"/>
        </div>
        {{/if}}
        <div class="store-card" id={{store.name}} style="{{#unless isSelectedStore store.name}}opacity: 0.3;{{/unless}}">
          <h5 class="store-card-name" id={{store.name}}>{{store.name}}</h5>
          <span class="store-card-id" id={{store.name}}>{{store.externalId}}</span>
        </div>
      </div>
  {{/each}}
  </div>
  {{> users}}
{{else isSeletedTab 2}}
  {{> roles}}
{{else isSeletedTab 3}}
  {{> users}}
{{/if}}
1
Can you show us the html code of the users and roles template ? Please show the the tags <template name="XXXX"></template> too. Btw, by default, you can't use condition inside the {{else}} and you can't put several else in your if. (Just saying, maybe you have special helper) - Gaëtan Rouziès

1 Answers

1
votes

You are using the {{if}} and {{else}} the wrong way. You can't use condition inside the else and there is no else if in Blaze.

Your code should be like this :

{{#if isSeletedTab 1}}
    {{> users}}
{{else}}
    {{#if isSeletedTab 2}}
        {{> roles}}
    {{else}}
        {{#if isSeletedTab 3}}
            {{> users}}
        {{/if}}
    {{/if}}
{{/if}}