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

Can you use native HTML attributes within x-option #105

Closed
LiquidFlame opened this issue Mar 18, 2016 · 2 comments
Closed

Can you use native HTML attributes within x-option #105

LiquidFlame opened this issue Mar 18, 2016 · 2 comments

Comments

@LiquidFlame
Copy link

Version of x-select: 2.1.0

Ember Version / Ember CLI Version:

Ember Version: 2.1.0
Ember CLI Version: 1.13.13

Expected Behavior

I should first mention I am extremely new to Ember

I'm trying to include the native "disabled" attribute of a select option within the x-option.

The disabled attribute is a boolean attribute. When present, it specifies that an option should be disabled.

Actual Behavior

The native "disabled" attribute doesn't seem to be processed at all. The work around that I have is by adding a "didInsertElement" into my component js, but ideally it would be better/easier if the x-option had some kind of disabled attribute like the native HTML select does.

didInsertElement: function () { this.$('option:first').attr('disabled', true); }

Steps To Reproduce:

  1. Create an x-select
  2. Create an x-option and try using the native HTML select option "disabled" attribute
  3. Example: {{#x-option disabled value=defaultSelect}} {{defaultSelect}} {{/x-option}}
@Robdel12
Copy link
Collaborator

Hi @LiquidFlame!

You should be able to pass disabled to x-option. What does your template look like?

This is what it could look like:

{{#x-select value=something}}
  {{#x-option value=charles disabled=true}}Charles{{/x-option}}
  {{#x-option value=bastion}}Bastion{{/x-option}}
  {{#x-option value=stanley}}Stanley{{/x-option}}
{{/x-select}}

@LiquidFlame
Copy link
Author

@Robdel12

I'm dumb, I'm use to just throwing in "disabled" on the option tag and it working.

Didn't think to actually use "disabled=true" which does work.

Thanks.

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

2 participants