MNZT
MNZT

Reputation: 157

Jade conditional - Unexpected else without if

block main
  h2.content-heading My profile
  .block
    .block-content.block-content-full
      a.block.block-link-hover2(href="#" data-toggle="modal" data-target="#modal-fadein" type="button")
        .block-header
            //- h3.block-title.text-center Author of the Month
        div(class="block-content block-content-full text-center bg-image" style=(account.backgroundImage))
          div
            img.img-avatar.img-avatar96.img-avatar-thumb(src=(account.avatar), alt='')
          .h5.text-white.push-15-t.push-5 #{account.displayname}
        .block-content
          .row.items-push.text-center
            .col-xs-6.col-xs-offset-3
              .push-5
            if account.premium
                i.fa.fa-bolt.fa-2x(style="color: #FF9800;")
              .h5.font-w300.text-muted Premium member
            else 
                i.fa.fa-thumbs-up.fa-2x(style="color: #3c3c3c;")
              .h5.font-w300.text-muted Free user

The error:

Unexpected else without if

I'm passing account.premium as false through res.render. Everything else under the account object is working fine, apart from this if/else block.

Upvotes: 0

Views: 562

Answers (1)

MNZT
MNZT

Reputation: 157

Indentation is important.

Working code: if account.premium i.fa.fa-bolt.fa-2x(style="color: #FF9800;") .h5.font-w300.text-muted Premium member else i.fa.fa-thumbs-up.fa-2x(style="color: #3c3c3c;") .h5.font-w300.text-muted Free user

Upvotes: 2

Related Questions