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

dynamically hide options #98

Closed
Nef10 opened this issue Mar 3, 2016 · 4 comments
Closed

dynamically hide options #98

Nef10 opened this issue Mar 3, 2016 · 4 comments
Milestone

Comments

@Nef10
Copy link

Nef10 commented Mar 3, 2016

I want to hide some options based on the property isStreak. So I wrote the following code:

{{#x-select value=format}}
  {{#each formats as |format|}}
    {{#x-option value=format}}{{format}}{{/x-option}}
  {{/each}}
  {{#unless isStreak}}
    {{#each buildStatesFormats as |format|}}
      {{#x-option value=format}}{{format}}{{/x-option}}
    {{/each}}
  {{/unless}}
{{/x-select}}

This code does show all options regardless of isStreak. If I put the whole x-select inside an unless everything works fine, but this is not what I am looking for.

Is this a bug, or is this just not supposed to work?

Version of x-select: 2.0.2
Ember Version / Ember CLI Version: 2.3.0

@Robdel12 Robdel12 added the Bug label Mar 3, 2016
@Robdel12 Robdel12 added this to the v2.1.0 milestone Mar 3, 2016
@Robdel12
Copy link
Collaborator

Robdel12 commented Mar 3, 2016

This sounds very much like a bug. We'll have to investigate what's going on.

@cowboyd
Copy link
Collaborator

cowboyd commented Mar 3, 2016

As a workaround, I'd suggest having a computed property that merges the two lists formats and buildStatesFormats according to the isStreak property. That way, you're only eaching over a single list.

Nef10 added a commit to HPI-BP2015H/travis-web that referenced this issue Mar 4, 2016
Robdel12 added a commit that referenced this issue Mar 10, 2016
@Robdel12
Copy link
Collaborator

Hey @Nef10!

I was able to sit down tonight and try to replicate this bug. It looks like this works as it should on master. Could you give master a shot and see if that fixes the issues in your app?

Here's the code that I used to replicate:

@Robdel12
Copy link
Collaborator

I went ahead and decided to investigate further since it's open source and opened a PR implementing what I think you were trying to do :)

HPI-BP2015H/travis-web#1

Going to close this issue.

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