Learn
Your First App
Directives

We’ve used a few directives so far - ng-app, ng-controller, ng-repeat, and ng-src. What can we generalize about directives?

Directives bind behavior to HTML elements. When the app runs, AngularJS walks through each HTML element looking for directives. When it finds one, AngularJS triggers that behavior (like attaching a scope or looping through an array).

Instructions

1.

In the controller, add two of your favorite books to the $scope.products array.

The view will update as the ng-repeat loops the new elements in the $scope.products array.

Folder Icon

Take this course for free

Already have an account?