Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

feat($parse): Adds range operators #8210

Closed
wants to merge 1 commit into from

Conversation

lgalfaso
Copy link
Contributor

Adds the operators '..' and '...' that work as range operators. These new operators are only valid within an array declaration and allows the array to be declared as a range. E.g.

<div ng-repeat="index in [1...pages.length]">{{index}}</div>

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#8210)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@caitp
Copy link
Contributor

caitp commented Jul 15, 2014

It looks like this will return a new array every time the expression is evaluated (I guess we were doing that already)... is that what we want? (serious question, I see pros/cons for both ways)

@lgalfaso lgalfaso added cla: yes and removed cla: no labels Jul 15, 2014
@lgalfaso
Copy link
Contributor Author

I put this up to start the discussion if this is something what we want

It looks like this will return a new array every time the expression is evaluated (I guess we were doing that already)... is that what we want? (serious question, I see pros/cons for both ways)

Even when we are already creating a new instance of the array every single time, it should be possible to cache the array in case the right hand side and left hand side are constants.
It still does not support characters as values. E.g. ['a'...'z']

Adds the operators '..' and '...' that work as range operators. These
new operators are only valid within an array declaration and allows
the array to be declared as a range. E.g.

```html
<div ng-repeat="index in [1...pages.length]">{{index}}</div>
```
@Narretz Narretz added this to the Backlog milestone Jul 16, 2014
@PatrickJS
Copy link
Contributor

+1

@lgalfaso
Copy link
Contributor Author

lgalfaso commented Jan 9, 2015

this is not going to happen in 1.x, so there is no need to keep this open

@lgalfaso lgalfaso closed this Jan 9, 2015
@pkozlowski-opensource
Copy link
Member

@lgalfaso just out of curiosity - was the implementation too big / difficult / generating too many corner cases or is it about perf considerations?

I won't be crying over this one, but it was kind of neat feature so was wondering what were the pbs with it.

@lgalfaso
Copy link
Contributor Author

lgalfaso commented Jan 9, 2015

@pkozlowski-opensource just not enough traction to make it into the core (specially when you can get a more flexible approach with filter)

@pkozlowski-opensource
Copy link
Member

@lgalfaso yeh, makes sense.

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

Successfully merging this pull request may close these issues.

7 participants