E commerce portal using Angular JS

414 views
Skip to first unread message

Dhruv Taneja

unread,
Mar 29, 2014, 11:51:54 AM3/29/14
to ang...@googlegroups.com
I am trying to create an imitation of an e commerce portal using Angular. The products are displayed in a <div> tag and are repeated for all the products from some file using ng-repeat.
But I want to halt the repeat process after a certain number of product divs, say 10, and show a load more products button. And when clicked, it should load more products, as it was doing earlier. How can I achieve this?


Lorenzo Bugiani

unread,
Mar 29, 2014, 12:03:22 PM3/29/14
to ang...@googlegroups.com
The first simple thing I can imagine is a filter...
You can implement a filter that returns only the first n elements in an array, passed as an argument. Then in the "show more product" button, you can change the variable that hold the number of products showed, and you are done: ng-repeat will be re evalutated, showing more product


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Dhruv Taneja

unread,
Mar 29, 2014, 12:22:30 PM3/29/14
to ang...@googlegroups.com
Thanks Lorenzo. But I would really like to know how to use that filter with ng-repeat. A short demonstration would be appreciated. :)

Kumar R

unread,
Mar 29, 2014, 1:56:05 PM3/29/14
to ang...@googlegroups.com
Hi, Dhruv Taneja,

I hope its helpful to you

http://argutech.blogspot.in/2014/01/angularjs-tutorials-filter-angularjs.html

On 3/29/14, Dhruv Taneja <dhruvta...@gmail.com> wrote:
> Thanks Lorenzo. But I would really like to know how to use that filter with
>
> ng-repeat. A short demonstration would be appreciated. :)
>

Lorenzo Bugiani

unread,
Mar 30, 2014, 3:50:59 PM3/30/14
to ang...@googlegroups.com

Dhruv Taneja

unread,
Mar 31, 2014, 7:13:44 AM3/31/14
to ang...@googlegroups.com
Thanks Lorenzo! :) 
This is it.


--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/3sCnWMZq2q4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.

To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages