0

So I'm trying to implement some handlebar directives to one of my templates, but I'm kind of lost on how to pass the JSON to the template so that it can make use of it in the directive.

Currently I have this in my View:

application = require 'application'
template = require('views/templates/appLayout')

module.exports = class AppLayout extends Backbone.Marionette.Layout
    template: template, loggedin: true
    el: "body"

    regions:
        content: "#content"

And this in the view's template:

<div class="navbar navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <a class="brand" href="#"><i class="icon-leaf"> </i> Application</a>

      <div class="nav-collapse"><!-- Other nav bar content -->

        <!-- The drop down menu -->
        <ul class="nav pull-right">
            {{#if loggedin}}
              <h1>Welcome back!</h1>
            {{else}}
                <input id="login" type="email" placeholder="E-mail" class="flat">
              <input id="password_login" type="password" placeholder="Password" class="flat">
              <button class="btn btn-primary btn-mini login btn-embossed">Sign in</button>
              <button class="btn btn-danger btn-mini register btn-embossed ">Sign up</button>
            {{/if}}
        </ul>
      </div>

    </div>
  </div>
</div>

<div id="content" class="container"></div>

Right now the template's else block is getting rendered, but I want the if block to get rendered. Does anyone know how to correctly implement this?

4

1 に答える 1