Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    AngularJS 1.2.x Does Not Allow Duplicate Keys in Repeaters

    This lesson was recorded using an older version of AngularJS. With AngularJS 1.2.x, there are some breaking changes that you should be aware of:

    html<div ng-repeat="value in [4, 4]"></div>

    In AngularJS 1.2.x, the above code results in an error. To fix this, you must use the track by syntax:

    html<div ng-repeat="value in [4, 4] track by $index"></div>

    This change causes the repeated items to be tracked by their index instead of their value. Scroll down to view the full corrected code for this lesson.

    ng-repeat and $index, $event, $log


    $index and $event are handy shortcuts that allow you to access useful information directly in your views. $log facilitates configurable logging without using console.log directly.