-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat(ngSwitch): add an optional attribute ngSwitchWhenSeparator #10798
Conversation
58f15f6
to
f5bf1cd
Compare
Does the separator need to be customizable? Why not settle on comma? |
})); | ||
|
||
|
||
it('should be possible to use the empty string as a separators', inject(function($rootScope, $compile) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: separator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx
@Narretz: I guess it is to enable using @lgalfaso: This might be a little farfetched, but it would be nice to allow setting the "default" separator on <ng-switch ng-switch-separator="|">
<ng-switch-when="a|b">A or B</ng-switch-when>
<ng-switch-when="c|d">C or D</ng-switch-when>
<ng-switch-when="|+$" ng-switch-separator="+">
| or $ (local separator overwrites default)
</ng-switch-when>
</ng-switch> |
Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`. Closes angular#3410 Closes angular#3516
f5bf1cd
to
38bf8ef
Compare
this would be a breaking change (that I am trying to avoid)
if there is some interest in this PR, then we can think about adding a default separator... doing so would be relatively easy |
Very needed feature, please merge it down. |
What if we made |
This would be pretty cool! A global configuration is probably not a good idea, because you cannot control what templates other modules might use. |
@petebacondarwin making it another directive could give some unexpected results. Eg. <div ng-switch="mode">
<p ng-switch-when="a|b" ng-switch-when-separator="|"><span other-directive/></p>
<p ng-switch-default>X</div>
</div> if |
@lgalfaso OK, let's leave it as it is. Shame that we traverse up past isolated scope boundaries when doing require :-) |
I still believe that moving |
@gkalpak Now that you say it, I think it makes sense. Although I guess that custom separators will be used quite rarely anyway (only when the default operator is a value). |
What default operator? |
Yeah, there's no default value of course. Merged to both master and 1.5.x. We can put this attribute on the ngSwitch later on. |
…SwitchWhenSeparator Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`. Closes angular#3410 Closes angular#3516 Closes angular#10798
…SwitchWhenSeparator Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`. Closes angular#3410 Closes angular#3516 Closes angular#10798
…SwitchWhenSeparator Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`. Closes angular#3410 Closes angular#3516 Closes angular#10798
…SwitchWhenSeparator Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`. Closes angular#3410 Closes angular#3516 Closes angular#10798
…SwitchWhenSeparator Adds an optional attribute `ngSwitchWhenSeparator` that allows multiple tokens to match a given `ngSwitchWhen`. Closes angular#3410 Closes angular#3516 Closes angular#10798
Adds an optional attribute
ngSwitchWhenSeparator
that allows multiple tokens to match a givenngSwitchWhen
.Closes #3410
Closes #3516