I've follow the ember-paper guide and defined the options data as below. The user is able to select any country from the options.
timeZoneOptions: Object.freeze([
{ groupName: "Asia", options:["Kabul","Yerevan","Baku","Dhaka","Brunei","Bangkok","Shanghai","Urumqi","Taipei","Macau","Tbilisi","Dili","Kolkata","Jakarta"]},
{ groupName: "Australia", options: ["Darwin", "Eucla", "Perth", "Brisbane","Lindeman","Adelaide","Hobbart","Currie","Melbourne"]},
])
Here is the code for the select option. It will display the options groupby the groupName.
{{#paper-select options=this.timeZoneOptions
selected=this.timeZone
onChange=(action (mut this.timeZone)) as |timeZon| }}
{{timeZon}}
{{/paper-select}}
I can't get the data using {{this.timeZone.groupName}}.
How can I do if i want to get the groupName based on the option user selected?
What you have there seems correct. Maybe the error lies in the
mutusage, maybe it's somewhere else.The
muthelper is quite vague. It is gonna be deprecated when the Ember team figures out how to do it gracefully.You can avoid the
muthelper by creating a distinct action on your controller/component.This will let you debug: simply put a
debuggerstatement into your action and proceed from there.Classic Ember style:
Ember Octane style: