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

Add mapping for core-dropdown #9

Closed
GabiAxel opened this issue Aug 11, 2014 · 2 comments
Closed

Add mapping for core-dropdown #9

GabiAxel opened this issue Aug 11, 2014 · 2 comments

Comments

@GabiAxel
Copy link
Owner

http://www.polymer-project.org/docs/elements/core-elements.html#core-dropdown
Added in Polymer 0.3.5

@DiegoBao
Copy link

After fighting a bit with the core-dropdown I manage to do it in this way:

First set the mappings for core-dropdown:

window.NG_POLYMER_ELEMENTS_EXTENDED_MAPPINGS = {
            coreDropdown: {
                ngModel: {
                    primitive: 'selected'
                }
            }
        };

Then:

<core-dropdown ng-model="mySelection">
    <core-item name="value1" label="Value 1"></core-item>
    <core-item name="value2" label="Value 2"></core-item>
</core-dropdown>

In this way the dropdown will set the variable mySelection with whatever is in the name attribute of core-item.
If name is not set, then it will set mySelection with the index of the element.

I tried to use valueattr of core-dropdown to set which attribute has the value to save but I couldn't make it work.

Hope this help

@GabiAxel
Copy link
Owner Author

Thanks, though it's already implemented in the head and will be included in the next release.

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

No branches or pull requests

2 participants