Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

select: multiple attribute only checks for existence but docs indicate that it evaluates true/false #3068

Closed
myagoo opened this issue Jun 1, 2015 · 9 comments · Fixed by #11316
Assignees
Labels
has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. resolution: fixed type: docs
Milestone

Comments

@myagoo
Copy link

myagoo commented Jun 1, 2015

If I want to tell wether a md-select should be multiple from a scope key, I must do this :

<md-select ng-if="multiple" multiple .../>
<md-select ng-if="!multiple" .../>

Because all those lines have the same behavior, they set initialize the select as multiple :

<md-select multiple="true" .../>
<md-select multiple="false" .../>
<md-select multiple="{{true}}" .../>
<md-select multiple="{{false}}" .../>

In the source code of md-select directive, I can see this LoC :
https://github.com/angular/material/blob/master/src/components/select/select.js#L387
I can understand why all 4 lines have the same behavior.

So I tried to use ng-multiple and the select started to work correctly... in appearance only : the model is now all messed up.

Here is a codepen where you can see select behavior and the associated model : http://codepen.io/myagoo/pen/OVWGqz

@dharitdesai
Copy link

+1

1 similar comment
@pdore-netfore
Copy link
Contributor

+1

@nextsoftpl
Copy link

+1

@danicomas
Copy link

No news?

@angular angular deleted a comment from biomassives Jun 6, 2018
@Splaktar Splaktar changed the title multiple attribute for md-select directive can't be set from scope select: multiple attribute only checks for existence but docs indicate that it evaluates true/false Jun 6, 2018
@Splaktar Splaktar self-assigned this Jun 6, 2018
@Splaktar Splaktar modified the milestones: Deprecated, 1.1.10 Jun 6, 2018
@Splaktar Splaktar added the P4: minor Minor issues. May not be fixed without community contributions. label Jun 6, 2018
@Splaktar Splaktar reopened this Jun 6, 2018
@Splaktar
Copy link
Member

Splaktar commented Jun 6, 2018

Re-opening this one as the CodePen is still valid and this issue still exists.

@Splaktar
Copy link
Member

Splaktar commented Jun 6, 2018

This seems to be partially related to angular/angular.js@d87fa00 where binding to multiple on select elements was disabled in AngularJS 1.2.0.

@Splaktar
Copy link
Member

Splaktar commented Jun 6, 2018

There is a lot more discussion related to that in:
angular/angular.js#3230
angular/angular.js#3337

@Splaktar
Copy link
Member

Splaktar commented Jun 6, 2018

As mentioned in those issues and #9705, ng-multiple was also removed in AngularJS 1.2.0.

We need to remove it from AngularJS Material as well. This removal is being tracked in #9705.

@Splaktar
Copy link
Member

Splaktar commented Jun 6, 2018

The docs are going to be updated to state:

multiple boolean When present, allows for more than one option to be selected. The model is an array with the selected choices. Note: This attribute is only evaluated once; it is not watched.

Any value that is passed into the multiple attribute will be ignored.

@Splaktar Splaktar removed the type: bug label Jun 6, 2018
Splaktar added a commit that referenced this issue Jun 6, 2018
fix syntax ordering error with `md-no-asterisk` docs
remove instances of `multiple="multiple"` from tests
update test to check for non-existence of multiple rather than value
add test to check for existence of multiple

Closes #3068
@Splaktar Splaktar added the has: Pull Request A PR has been created to address this issue label Jun 6, 2018
jelbourn pushed a commit that referenced this issue Jun 22, 2018
fix syntax ordering error with `md-no-asterisk` docs
remove instances of `multiple="multiple"` from tests
update test to check for non-existence of multiple rather than value
add test to check for existence of multiple

Closes #3068
Splaktar added a commit that referenced this issue Jul 31, 2018
fix syntax ordering error with `md-no-asterisk` docs
remove instances of `multiple="multiple"` from tests
update test to check for non-existence of multiple rather than value
add test to check for existence of multiple

Closes #3068
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
has: Pull Request A PR has been created to address this issue P4: minor Minor issues. May not be fixed without community contributions. resolution: fixed type: docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants