AngularJS ng-repeat

DZ1EFM9PIK AngularJS allows me to loop through an array with the ng-repeat directive very easily.

(The ‘Resources’ tab will show you the JavaScript and css files I’ve included and the ‘Result’ tab will show you the output.)

Notice the ng-init initializes the array with a list of languages. ng-repeat="language in languages" will loop through the languages array assigning each element to the language variable. {{ language }} will output each of the languages in the array.

The example below uses an object and another loop to access the key/value pair instead of an array:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top