-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Moving aliasing special properties of ngRepeat from ngInit to ngRepeat #5623
Comments
I don't really see the benefit, it would be a breaking change and not a particularly useful one. I'm all for your proposed documentation changes, but this seems like it's taking it a bit far |
Actually it's a nice idea. Would you like to create a PR for this? |
I can see how it could be useful, but there are downsides to it: Even without replacing ngInit, it makes the ngRepeat expression more complicated, which is a downside, even if it looks nice. Removing ngInit entirely is a breaking change with no particularly good reason (it's a mistake to assume ngRepeat is the only use of ngInit) --- without removing ngInit, it's duplicating code and making ngRepeat more complicated without any real tangible benefit. So I'm just not seeing it. But, if that's what people want to do then okay --- I just don't see how it's a worthwhile thing, I'd be much happier about making a comment about ngInit in the ngRepeat docs. |
Wow, when was that tagline being added? It's certainly not there at least prior to Aside from that - I agree with @caitp that this will further complicate the syntax and implementation of |
Found the issue that added the tagline: #4366 |
You guys are right. Thanks for your constructive opinions.
My updated stance towards adding the feature directly to
The only benefit it would bring is not introducing excessive scope variable (depending on a concept: aliasing vs. renaming) - in the example we have 2: |
we should solve this in 1.3.x. I'd like to see less magic in ngRepeat but we shouldn't make the syntax too complicated. |
@IgorMinar anything concrete on how a less magical ngRepeat should look like? |
I don't think we should be changing or removing Regarding |
Adding these extra clauses to the |
Changed the note in the |
Currently the only one appropriate use of ngInit is aliasing
$index
and other special properties of ngRepeat.I'd like suggest moving this functionality to ngRepeat.
It could look like:
Pros:
Cons:
Right now it's one of the biggest directives if LoC is concerned.
Also, just to make writing hello-worlds on plunker a little tougher, removing ngInit entirely could be considered.
Yes, I know I'm crazy, but this could be only done if there are really few hackish solutions which employ ngInit.
Just wanted to know that you guys think of this.
The text was updated successfully, but these errors were encountered: