Pass param to controller function in a template

I have a Controller with a method that is giving back the CountryName when it receives the CountryCode:

// my Controller
export default Ember.Controller.extend({
  countryName: function(countryCode){
    let countryName = <logic to get the CountryName>;
    return countryName;

In my template I would like to be able to do this:

  {{countryName "ES"}}

But looks like Ember is looking for a helper called countryName and it is not existing.

Looks like is not possible to pass a param to a Controller method from a template and you have to create a intermediate helper.

Is there an easy way to use a parameterized Controller method from a template?

You’ll definitely want to use a helper. If you don’t want to create one specifically for this use case, you can use ember-composable-helpers's compute helper to achieve this:

{{compute (action countryName) "ES"}}

Thanks @Spencer_Price… at the end I implemented a Helper but the composable-helper looks nice too.


Exactly what I’m looking for. :ok_hand:t2: