Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple {{x-selects}} on the same template #48

Closed
shamanime opened this issue Jul 16, 2015 · 4 comments
Closed

Multiple {{x-selects}} on the same template #48

shamanime opened this issue Jul 16, 2015 · 4 comments

Comments

@shamanime
Copy link

I am trying to use multiple selects on my template, as follows:

<label>Type</label>
{{#x-select value=model.type.content action="selectType"}}
  {{#each types as |item|}}
    {{#x-option value=item}}{{item.name}}{{/x-option}}
  {{/each}}
{{/x-select}}
<label>Status</label>
{{#x-select value=model.status.content action="selectStatus"}}
  {{#each statuses as |item|}}
    {{#x-option value=item}}{{item.name}}{{/x-option}}
  {{/each}}
{{/x-select}}

But this throws the following message in the console:

Error: Assertion Failed: x-option component declared without enclosing x-select

If I remove either of the selects, it works.

The relevant route code:

import Ember from 'ember';

export default Ember.Route.extend({
  setupController: function(controller, model) {
    this._super(controller, model);

    controller.set('statuses', this.store.findAll('status'));
    controller.set('types', this.store.findAll('type'));
  },

  actions: {
    selectStatus: function(selection) {
      console.log('Selecting status');
      if (selection) {
        this.get('currentModel').set('status', selection);
      }
    },

    selectType: function(selection) {
      console.log('Selecting type');
      if (selection) {
        this.get('currentModel').set('type', selection);
      }
    }
  }
});

Am I doing something wrong?

PS: Using version 1.1.4, ember-cli 1.13.1.

@jcope2013
Copy link

i have got multiple ones working but was seeing something similar when i had two until i got it working, it seemed async related so i switched some stuff around, nothing real specific, you could also try master of this repo in your package.json and see if it clears it up

these may clear it up

#44
#45

@Robdel12
Copy link
Collaborator

I'm curious: if you just upgrade ember to 1.13.4, does that fix it?

I really need to finish this blog post. There a couple ember bugs that make using this addon a little less reliable.

@shamanime
Copy link
Author

@Robdel12 oh, it did work with Ember 1.13.4 (forgot to say that it was 1.13.3 previously) on both master and 1.1.4.

Works like a charm now. I should have tried this before creating the issue.

Thank you!

@Robdel12
Copy link
Collaborator

@shamanime Awesome! Glad that worked :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants