if else condition in hbs file

i want to put if else condition in hbs file 
I tried for this code , but it is not working 
 {{#if  name 'Management Review'}}
                <a style="color:red"  href="#{{module_type}}/{{id}}" target="_blank">{{name}}</a>
                {{else}}
                <a href="#{{module_type}}/{{id}}" target="_blank">{{name}}</a>
                {{/if}} 
please suggest
  • It is better to set an attribute in the js controller and evaluate it in hbs:

    js controller

    this.managementReview = true;

    hbs

    {{#if managementReview}}

    <a style="color:red" href="#{{module_type}}/{{id}}" target="_blank">{{name}}</a>
    {{else}}
    <a href="#{{module_type}}/{{id}}" target="_blank">{{name}}</a>
    {{/if}}

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • The default "if" that you have used only checks if the value is true/set or false/empty. If you want comparison logic, you can write your own "equals" helper, for example: eg:

    
            Handlebars.registerHelper('equals', function (a, b, opts) {
                if (a === b)
                    return opts.fn(this);
                else
                    return opts.inverse(this);
            });
        

    You can then use this helper in your code like:

    
         {{#equals  name 'Management Review'}}

    Follow this documentation on how to create custom HandleBars helpers in the code : https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_9.2/User_Interface/Handlebars/#Creating_Helpers