Reputation: 28930
How do I pass "simple" arguments to an action helper for example:
<li><a {{action markRead true target="controller"}}>Todo</a></li>
True would be the argument I want to pass.
This obviously does not work.
Does it have to be an ember path for this to work?
Upvotes: 3
Views: 1424
Reputation: 8389
In recent versions of Ember (certainly >= 2.0), your example would be written as:
<li><a {{action "markRead" true target="controller"}}>Todo</a></li>
and true would be a boolean as you want it to.
Older versions of Ember would interpret true
as a property path and attempt to resolve it's value.
Upvotes: 2
Reputation: 2145
maybe this has been added to ember.js recently, but you most certainly can pass parameters in action helpers
template:
{{action "downloadVideo" this false}}
route:
var ApplicationRoute = FooRoute.extend({
actions: {
downloadVideo: function(video, closeModal) {
console.log("closeModal", closeModal); //outputs "closeModal false" if this didnt work it would output "closeModal undefined"
}
}
});
Upvotes: 3