You called <tracker@component:x-select::ember236>.sendAction(“action”) but Component#sendAction is deprecated. Please use closure actions instead.
<div class="form-group">
<label for="name">Cryptid</label>
{{#x-select value=model.sighting.cryptid class="form-control" as |xs|}}
{{#xs.option}}Select Cryptid{{/xs.option}}
{{#each model.cryptids as |cryptid|}}
{{#xs.option value=cryptid}}{{cryptid.name}}{{/xs.option}}
{{/each}}
{{/x-select}}
how to use closure actions?
try the follow, get same error:
<div class="form-group">
<label for="name">Cryptid</label>
<XSelect @value={{model.sighting.cryptid}} @onClick={{action 'didMakeCryptidSelection' }} class="form-control" as |xs|>
<xs.option>Select Cryptid</xs.option>
{{#each model.cryptids as |cryptid|}}
<xs.option @value={{cryptid}}>{{cryptid.name}}</xs.option>
{{/each}}
</XSelect>
@action
didMakeCryptidSelection(value, event) {
if (!value) {
this.set('error', 'You must fill out this field');
} else {
//this.set('selection', value);
this.get('model.sighting').set('cryptid', value);
}
}
@action
didMakeWitnessSelection(value, event, isXSelectRequired) {
if (!value & isXSelectRequired) {
this.set('error', 'You must fill out this field');
} else {
//this.set('selection', value);
this.get('model.sighting').set('witnesses', value);
}
}