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

bindonce repeater #10

Open
elemoine opened this issue Jul 20, 2013 · 20 comments
Open

bindonce repeater #10

elemoine opened this issue Jul 20, 2013 · 20 comments
Labels

Comments

@elemoine
Copy link

ng-repeat registers a collection watcher (with $watchCollection), which can be costly, especially when considering ng-repeat based recursive directives (as in http://jsfiddle.net/n8dPm/).

I was wondering if a bindonce type repeater would make sense. That repeater would wait for the collection to be there, but wouldn't shallow-watch the collection.

Not sure it makes sense. Feel free to close this issue if it doesn't. Thanks.

@Pasvaz
Copy link
Owner

Pasvaz commented Jul 23, 2013

Yes it makes sense, I've been thinking a lot about creating bo-repeat in order to get rid of the watcher but not only for that, a repeater uses one watcher ($watchCollection as you said) but what makes it expensive in term of performances is the creation of a child scope for each item, in case of large set can be costly. Now bo-* fields can live without child scopes because once the item is drawn even if the scope change it is no longer bound with the scope, but if you use any ng-* field inside the bo-repeater you immediately run into scope issues.
However we can try to deal with this is it is necessary...

@akarelas
Copy link

👍. I found many cases in my websites where I'd need to use that.

@adamkdean
Copy link

👍 It would be one of the most useful cases, especially when grids loop through rows and columns.

@FGRibreau
Copy link

👍

1 similar comment
@mendelk
Copy link

mendelk commented Jan 13, 2014

👍

@Pasvaz Pasvaz mentioned this issue Jan 24, 2014
@evilaliv3
Copy link

👍

@MWallenberg
Copy link

I need this in my life. But mostly, I need it in my code... Pasvaz, any time you spend towards making this a reality would be much appreciated :)

@Pasvaz
Copy link
Owner

Pasvaz commented Feb 16, 2014

Hi @MWallenberg, this will be the next step, right now I'm focusing on the rebind feature, when the new binding system will work flawlessy it shouldn't be a problem to implement a repeater.

@pgayvallet
Copy link

+1, would be awesome to have

@mparpaillon
Copy link

👍

1 similar comment
@philippzentner
Copy link

👍

@schickling
Copy link

👍 looking forward to this feature

@fidoboy
Copy link

fidoboy commented May 9, 2014

👍

1 similar comment
@steve8708
Copy link

+1

@akarelas
Copy link

akarelas commented Aug 6, 2014

I believe that Angular 1.3 solves this problem, like so:

<li ng-repeat="item in ::items">{{::item.name}}</li>

@michael-wynn
Copy link

akarelas, I looked at Angular 1.3 documentation and don't see any mention of the syntax you posted. Where do get that from?

@akarelas
Copy link

@michael-wynn I don't know where I learned it from (maybe from the Changelog of Angular 1.3) but it works.

@lorenzhs
Copy link

@michael-wynn
Copy link

@lorenzhs
Copy link

In fact, I replaced bindonce with Angular one-time bindings in Glowing Bear yesterday: glowing-bear/glowing-bear#418

It started with adding :: to ng-repeat statements, but it soon emerged that we could drop bindonce altogether, as we're using angular 1.3 beta in production 💣 Now we have one less dependency (even if it was only 6.5k minified). Sorry to abandon you ;)

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

No branches or pull requests