Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Web Browser
Learn

Great! A gallery of images shows up. How does it work?

  1. In app.js inside the app.config() method, we use Angular's $routeProvider to define the application routes.
  2. We used .when() to map the URL / to to the controller HomeController and the template home.html. The HomeController uses the service js/services/photos.js to fetch the array of all photos from https://s3.amazonaws.com/codecademy-content/courses/ltp4/photos-api/photos.json and stores it into $scope.photos. The home.html uses ng-repeat to loop through each item in the photos array and display each photo.
  3. Otherwise if a user accidentally visits a URL other than /, we just redirect to / using .otherwise().
  4. Now when a user visits /, a view will be constructed by injecting home.html into the <div ng-view></div> in index.html.
Report a Bug
If you see a bug or any other issue with this page, please report it here.