Open elemoine opened 11 years ago
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...
:+1:. I found many cases in my websites where I'd need to use that.
:+1: It would be one of the most useful cases, especially when grids loop through rows and columns.
:+1:
:+1:
:+1:
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 :)
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.
+1, would be awesome to have
:+1:
:+1:
:+1: looking forward to this feature
:+1:
+1
I believe that Angular 1.3 solves this problem, like so:
<li ng-repeat="item in ::items">{{::item.name}}</li>
akarelas, I looked at Angular 1.3 documentation and don't see any mention of the syntax you posted. Where do get that from?
@michael-wynn I don't know where I learned it from (maybe from the Changelog of Angular 1.3) but it works.
@michael-wynn @akarelas https://docs.angularjs.org/guide/expression#one-time-binding
Thank you!
From: Lorenz Hübschle-Schneider [mailto:notifications@github.com] Sent: Saturday, August 23, 2014 3:45 AM To: Pasvaz/bindonce Cc: michael-wynn Subject: Re: [bindonce] bindonce repeater (#10)
@michael-wynn https://github.com/michael-wynn @akarelas https://github.com/akarelas https://docs.angularjs.org/guide/expression#one-time-binding
— Reply to this email directly or view it on GitHub https://github.com/Pasvaz/bindonce/issues/10#issuecomment-53149458 . https://github.com/notifications/beacon/4787565__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyNDQwOTkyMiwiZGF0YSI6eyJpZCI6MTM5NjQxOTF9fQ==--355d83e1f1550465505a3205688358a9af8b503f.gif
In fact, I replaced bindonce with Angular one-time bindings in Glowing Bear yesterday: https://github.com/glowing-bear/glowing-bear/pull/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 :bomb: Now we have one less dependency (even if it was only 6.5k minified). Sorry to abandon you ;)
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.