ember version=3.22 , emberx-select=3.1.1
new.js file:
<h1>New Sighting</h1>
<form {{action "create" on="submit"}}>
<div class="form-group">
<label for="name">Cryptid</label>
{{#x-select value=model.sighting.cryptid class="form-control" }}
{{#x-option}}Select Cryptid{{/x-option}}
{{#each model.cryptids as |cryptid|}}
{{#x-option value=cryptid }} {{cryptid.name}} {{/x-option}}
{{/each}}
{{/x-select}}
</div>
<div class="form-group">
<label>Witnesses</label>
{{#x-select value=model.sighting.witnesses multiple=true class="form-control" }}
{{#x-option}}Select Witnesses{{/x-option}}
{{#each model.witnesses as |witness|}}
{{#x-option value=witness}}{{witness.fullName}}{{/x-option}}
{{/each}}
{{/x-select}}
</div>
<div class="form-group">
<label for="location">Location</label> {{input value=model.sighting.location
type="text" class="form-control" name="location" required=true}}
</div>
<button type="submit" class="btn btn-primary btn-block">Create</button>
<button {{action 'cancel'}} class="btn btn-link btn-block">Cancel</button>
</form>
and x-option.js file is editted :
.........
* @override
*/
didInsertElement() {
let self=this;
self._super.apply(this, arguments);
scheduleOnce('afterRender', () => {
self.get('register');
});
},
/**
* Unregister this x-option with its containing x-select.
*
* @override
*/
willDestroyElement: function() {
this.get('unregister');
this._super.apply(this, arguments);
}
});
now this plug-in is ok