Skip to content

Partial's context is undefined #135

@JuoCode

Description

@JuoCode

My partiial _navbar.hbs:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Dawn</title>
</head>
<body>

  <h1>Hello</h1>

  <nav>
    <ul>
      {{#each navbarItems}}
      <li>
        <a href="{{link}}">{{title}}</a>
      </li>
      {{/each}}
    </ul>
  </nav>

My page index.hbs:

{{> navbar }}

<div class="page-index">
  <h4>Home, {{name}}</h4>
</div>

I custome task in Gruntfile.coffee:

// require handlebars
Handlebars = require './vendor/handlebars/handlebars'

// custome task
templates = (require "./.tmp/jst/template")(Handlebars)
html = templates['index']({
  name: 'juo'
  navbarItems: navbarItems
})

Then i log the html, there is no li element in nav > ul

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions