Advertisement
Guest User

Problem Passing Vars to Handlebar Helpers

a guest
Mar 31st, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Handlebar Helper -- helpers/if-type-is.js
  2.  
  3. import Ember from "ember";
  4.  
  5. export default function(type, assType) {
  6.   return assType === type;
  7. }
  8.  
  9. // Handlebar Template --- templates/assignments/reflections.hbs
  10.  
  11. {{#each assignment in model}}
  12.   {{#if-type-is 'reflection' assignment.type}}
  13.     <div>
  14.     <p>{{assignment.name}} is a reflection</p>
  15.     </div>
  16.   {{/if-type-is}}
  17. {{/each}}
  18.  
  19.  
  20. // The helper keeps getting passed two strings: "reflection" and "assignment.type" instead of the actual property value for assignment.type, and thus the condition is never satisfied and nothing is rendered.
  21.  
  22. // What is the proper syntax for passing my helper the object's property value?
  23.  
  24. // Thanks.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement