GithubHelp home page GithubHelp logo

Comments (17)

allaud avatar allaud commented on June 2, 2024

@djsmith42
quickRepeatList attribute contains a key name for hash storing $watch callbacks. While linking a new directive, we store a reference to $watch callback in that hash using quickRepeatList attribute:

https://github.com/allaud/quick-ng-repeat/blob/master/quick-ng-repeat.js#L126

And the next time we need to refresh our list we don't need to wait for digest cycle (which is usually heavy, moreover it is done synchronously). Instead we can call this callback manually and asynchronously:

https://github.com/allaud/quick-ng-repeat/blob/master/example/js/main.js#L53

This allows us to make a heavy list render without blocking ui (and many more things, redraw some lists eventually for example, without redrawing the whole application).

So, the answer to your questing is - yes, most of the time you should use uniq names for that attribute. But I also can imagine some rare situations, when you need to replace one watcher callback with another.

from quick-ng-repeat.

viktor-evdokimov avatar viktor-evdokimov commented on June 2, 2024

Why wouldn't you generate unique one yourself if you need it pretty much every time ?

from quick-ng-repeat.

allaud avatar allaud commented on June 2, 2024

@ojosdegris can you show the line of code you are speaking about?

from quick-ng-repeat.

viktor-evdokimov avatar viktor-evdokimov commented on June 2, 2024

@allaud I'm talking about quick-repeat-list directive, if it is better to have it every time, why not to generate unique value for it inside main directive ?

from quick-ng-repeat.

allaud avatar allaud commented on June 2, 2024

@ojosdegris this the the code from html:

<div quick-ng-repeat="item in list" quick-repeat-list="items">

And this is the code from main.js , which contains some lazy-load logic:
https://github.com/allaud/quick-ng-repeat/blob/master/example/js/main.js#L53

 _.defer(quickRepeatList.items, $scope.list);

Specifying this name lets us to call from our code directly the list we want to operate with.

from quick-ng-repeat.

justinmc avatar justinmc commented on June 2, 2024

Then is there a way to supply this parameter dynamically?

I'm using quick-ng-repeat in a template that is used twice on the same page. Each instance needs a unique quick-repeat-list value, but because this is in a template, I can't supply two different values. If I use a scope variable like this it doesn't work: quick-repeat-list="[[ myQuickRepeatList ]]".

I realize that this parameter is necessary to refer to your list in javascript, but if I understand it correctly, the current setup still seems not ideal since it makes the plugin unusable in my case. If there's no way to supply quick-repeat-list dynamically, would it be better to store watch callbacks as an array of objects instead?

from quick-ng-repeat.

lezhangxyz avatar lezhangxyz commented on June 2, 2024

Agreed, this doesn't seem like something that the developer should need to set for 99% of cases. The directive should generate its own unique values unless explicitly specified.

from quick-ng-repeat.

allaud avatar allaud commented on June 2, 2024

@justinmc @leisms accepted, the fix is coming

from quick-ng-repeat.

allaud avatar allaud commented on June 2, 2024

@justinmc @leisms this addition should do the trick: b5e51ac

from quick-ng-repeat.

justinmc avatar justinmc commented on June 2, 2024

I think you mistyped from one copy of the quick-ng-repeat.js file to the other, check out my pull request.

After applying my pull request, this works for my use case. Thanks for the quick fix, I think it's much better like this! Now if you want to updated all instances, you can do something like this:

for (var key in quickRepeatList) { 
    quickRepeatList[key](mydata); 
}

This is really useful when you have multiple instances of quick-ng-repeat operating on the same data, especially when you're unable to assign unique quick-repeat-list parameters like I was.

from quick-ng-repeat.

allaud avatar allaud commented on June 2, 2024

@justinmc yep, this was my mistake, thanks for contributing. I think, we can close this issue

from quick-ng-repeat.

llchan avatar llchan commented on June 2, 2024

It may be worth mentioning here that issue #9 addresses some of the use cases mentioned in this thread. The change will give you more flexibility in naming dynamically-generated lists so you can retrieve them later.

from quick-ng-repeat.

justinmc avatar justinmc commented on June 2, 2024

@Adarsh456 Your code is missing!

from quick-ng-repeat.

felix-d avatar felix-d commented on June 2, 2024

Quick-ng-repeat solved my issue with weird animated floating divs' behavior. Thanks!
http://stackoverflow.com/questions/25020731/racing-condition-with-dom-manipulation-ng-repeat-and-ng-class-animation-in-angu/25023599#25023599

from quick-ng-repeat.

anilkhichar avatar anilkhichar commented on June 2, 2024

Thank a lot....It get me rid of performance issues in IE8.

from quick-ng-repeat.

yeddu avatar yeddu commented on June 2, 2024

I want to repeat the hierarchical data using quick-ng-repeat. How can i do this?

from quick-ng-repeat.

alirizwan avatar alirizwan commented on June 2, 2024

This is going on in: vm.FilteredData = $filter('filter')(vm.data, { CategoryId: vm.currentCategory.id });

All I get is one empty item. What could I be doing wrong here? Is it because of quick-repeat-list?

from quick-ng-repeat.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.