I currently have a helper that looks like:
Ember.Handlebars.registerHelper('ifEq', function(a, b, opts) {
if (a == b) {
return opts.fn(this);
} else {
return opts.inverse(this);
}
});
and in my template, I do
GRAPH_TYPE: {{graphType}}
{{#ifEq graphType "p_graph"}}
TEST1
{{else}}
TEST2
{{/ifEq}}
However, this displays
GRAPH_TYPE: p_graph TEST2
This leaves me confused as there should be an exact string match above.
So, I dug into the web inspector and noticed that the value of a in the Handlebars helper was of the value graphType. Why wasn't the value passed in and how do I ensure that it is passed in?
Aucun commentaire:
Enregistrer un commentaire