Coder Social home page Coder Social logo

Comments (10)

kamilkp avatar kamilkp commented on May 30, 2024 6

That's entirely not the fault of vs-repeat. The problem is that vs-repeat creates new non-isolated scope. And if you write:

<div ng-repeat="item in filtered = (items | filter:MyFilter | filter:query )">

you basically write to a filtered variable on the current scope. If you wrap it with vs-repeat the filtered variable gets written into vs-repeat's scope not the outer scope. Writing like that:

<div ng-repeat="item in filtered.result = (items | filter:MyFilter | filter:query )">

should fix the issue. Chceck out the updated gist: https://gist.github.com/kamilkp/40332795f8cf256772ce/revisions

I didn't test it but i'm pretty sure it will work like that.

from angular-vs-repeat.

kamilkp avatar kamilkp commented on May 30, 2024

Yes, filters are not supported yet. Also this syntax:

<div ng-repeat="{key, value} in someObject">

is not supported yet.
Supporting filters is relatively easy to implement so i'll try to do it by the end of the week.

from angular-vs-repeat.

tcdevs avatar tcdevs commented on May 30, 2024

That would be great!

from angular-vs-repeat.

kamilkp avatar kamilkp commented on May 30, 2024

Try it now (pull latest commit from master). Filters should be working now.

from angular-vs-repeat.

tcdevs avatar tcdevs commented on May 30, 2024

Kamilkp it works like a charm, just tested it with multiple filters. 😉 Thanks for the help!

from angular-vs-repeat.

tcdevs avatar tcdevs commented on May 30, 2024

Your directive is best solution (imo) for data with 200+ items, instead of pagenation or (fullpage) inifinity scroll.

from angular-vs-repeat.

tcdevs avatar tcdevs commented on May 30, 2024

I noticed that this type of filtering syntax is not working:
<div ng-repeat="item in filtered = (items | filter:MyFilter | filter:query )">
This is useful to get the total length of the filtered items.

from angular-vs-repeat.

kamilkp avatar kamilkp commented on May 30, 2024

Well, that's odd since my regex produces the exact same output as the regex in the original ngRepeat directive. Can you make a jsfiddle with an example?

from angular-vs-repeat.

tcdevs avatar tcdevs commented on May 30, 2024

I had problems with jsFiddle so i made a gist with single html file example. Both with a normal ng-repeat and vs-repeat. You can check it here: https://gist.github.com/tcdevs/b53858b2df776ce9f3ff

When you run the example you see that the applied filters and filtered1 model work correctly but the filtered2 model not.

from angular-vs-repeat.

tcdevs avatar tcdevs commented on May 30, 2024

I did test it and you are once again correct. Nice trick to use the ng-init attribute! That's one of the ng-attributes i never actually use, but in this case its handy.

Thanks again for the quick help!

from angular-vs-repeat.

Related Issues (20)

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.