#Unless is not working



As you can see I have no customers in my collection.

So why does this code not work?

    customers() {
        return Customers.find({}, { sort: { checked: -1 } });
 {{#unless customers}}
        <div class="ui icon message">
            <img class="icon" src="images/customers.png">
            <div class="content">
                <div class="header">
                    No customers
                <li>You have no customers in your shop.</li>
                <li>Let's insert some by hand, in the add new customer box above </li>
                <li>Or press the blue arrow, next to the generate button, to insert some dummy customers for our Fictive SaaS environment </li>
        <img class="icon" src="images/customers.png">
        {{NrCustomers}} Customers stored in the database of our fictive SaaS platform </h4>
        <table class="ui celled striped table">
                    <th>Delete customer</th>
                    <th>Generate Stream</th>
                {{#each customers}} {{> customer}} {{/each}}


#unless will take only boolean value right?



unless is the opposite of if, so I think my code should have worked. I now moved it back to if (noCustomers) and that works perfectly. So I think we have a bug.


  dog: {
    name: 'Spot',
    age: 3,
    sleeping: false


<template name="pet">  
  {{#unless dog.sleeping}}
    {{dog.name}} is awake!
    {{dog.name}} is sleeping!


Customers is an empty array [] not null/undefined so it’s truthy. Try {{#unless customers.length}}.


hahaha! thanks… that explains it… I thought it was falsy because of javascripts falsy rules… cool…

this works (I do the check now in my helper)

 {{#if noCustomers}}
        <div class="ui icon message">
            <img class="icon" src="images/id.png">
            <div class="content">
                <div class="header">
                    <h4>No users</h4>
                <p> Please insert at least one user in a customer so we can simulate the Single Sign on</p>