3

Generally ng-repeat is used to represent the objects and arrays in the view from the controller.It is used for repeating each element in the group of data.Here I want to know the alternate way for representing the group of data in the view without using ng-repeat.

2 Answers 2

1

Although the answer is dependent on situation in which you provide solutions anyway,

As per my development experience ng-repeat is good if you data is very less.and if data is heavy the performance of ng-repeat reduces considerable amount.

Inorder to solve above problem we can go for custom directives

Here are some of the directives which you can look for getting some idea

AngularJS ng-repeat Alternative Approach

This document will give all step by step approach to create custom directives.

This is about alternative approach to ng-repeat to handle heavy data binding with better page performance. This article will provide insights of how to replace particular ng-repeat with particular data.

AngularJS directive for much more quicker lists rendering

A custom directive you can add and you can customize based on your requirements with following features

  • Shallow list watch (ngRepeat uses deep watch)
  • Animations support
  • Special service to cause list render outside of digest cycle
  • Smooth scrolling even on heavy compited lists (check example)
  • About 200% performance boost
  • Still hesitating? Try to scroll page with ng-repeat list and a page with quick-ng-repeat

Apart from this i can go for some solutions such as pagination lazy loading etc to improve performance

Sign up to request clarification or add additional context in comments.

Comments

0

ng-repeat is good to use when you don't have a large amount of data. There is an advantage using ng-repeat, whenever you use track by $index, it will do some hashing, and when it encounters a similar kind of element as you update the model properties, it won't recalculate the layout for that particular element.Behind the scenes, ngRepeat adds a $$hashKey property to each task to keep track of it.

But ng-repeat is not the right thing to use when you have large datasets as it involves heavy DOM manipulations. And you should consider using ng-repeat with pagination.

You can consider using transclusion inside a custom directive, to achieve the behavior you are looking for without using ng-repeat.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.