EmberJS – Template Condition Unless

It executes the only false block of statements.

Syntax

{{#unless falsy_condition}}
   //block of statement
{{/unless}}

Example

The example given below shows the use of the unless conditional helper in the Ember.js. Create a template called application.hbs under app/templates/ with the following code −

{{#unless check}}
   <h3> boolean value is {{check}}</h3>
{{/unless}}

Now create the controller called application.js file, which will be defined under app/controller/ with the following code −

import Ember from 'ember';

export default Ember.Controller.extend ({
   bool: false,
   check: function () {
      return this.bool;
   }.property('content.check')
});

Output

Run the ember server and you will receive the following output −

false block of statements

Previous Page:-Click Here

Leave a Reply