Git Product home page Git Product logo

Comments (6)

jonschlinkert avatar jonschlinkert commented on August 15, 2024

There is a better way to accomplish this. Example:

<ul class="nav">
  <li{{#is title "Home"}} class="active"{{/is}}>
    <a href="./index.html">Home</a>
  </li>
  <li{{#is title "Partials"}} class="active"{{/is}}>
    <a href="./partials.html">Partials</a>
  </li>
</ul>

from handlebars-helpers.

myplaneticket avatar myplaneticket commented on August 15, 2024

that works but it adds a false text for false values

<ul class="nav">
  <li false>
    <a href="./index.html">Home</a>
  </li>
</ul>

from handlebars-helpers.

jonschlinkert avatar jonschlinkert commented on August 15, 2024

{{#is title "Home"}} class="active"{{else}}{{/is}}

from handlebars-helpers.

Angelita31 avatar Angelita31 commented on August 15, 2024

It doesnot work for me, I got this message Error: Missing helper: "is"
at Object. (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\handlebars\dist\cjs\handlebars\helpers\helper-missing.js:19:13)
at Object.eval [as main] (eval at createFunctionContext (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:254:23), :6:66)
at main (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\handlebars\dist\cjs\handlebars\runtime.js:175:32)
at ret (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\handlebars\dist\cjs\handlebars\runtime.js:178:12)
at ret (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\handlebars\dist\cjs\handlebars\compiler\compiler.js:526:21)
at ExpressHandlebars._renderTemplate (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\express-handlebars\lib\express-handlebars.js:247:12)
at ExpressHandlebars. (C:\Users\UsuarioHP\AppData\Roaming\npm\nodeauth\node_modules\express-handlebars\lib\express-handlebars.js:173:21)
at

from handlebars-helpers.

Angelita31 avatar Angelita31 commented on August 15, 2024

This is my code and I get Cannot read property 'includeZero' of undefined
<ul class="nav navbar-nav"> <li{{#if title "Members"}} class="active" {{/if}}> <a class=""href="/">Members</a> </li> <li {{#if title "Register"}} class="active" {{/if}}><a href="/users/register">Register</a></li> <li {{#if title "Login"}} class="active" {{/if}}><a href="/users/login">Login</a></li> </ul>

from handlebars-helpers.

doowb avatar doowb commented on August 15, 2024

@Angelita31 if you have a bug with helpers from handlebars-helpers, then please open a new issue for the bug. If you need help with Handlebars, then you should ask questions on StackOverflow since more people will see it.

In either case, you should show more information... like how are you registering handlebars-helpers with Handlebars and how are you compiling and rendering your template?

from handlebars-helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.