Creating the routes
Let's replace the current stock routes with more meaningful ones. Update the app/js/app.js
file by adding the highlighted lines of code:
'use strict'; // Declare app level module which depends on filters, and services angular.module('myApp', [ 'ngRoute', 'myApp.filters', 'myApp.services', 'myApp.directives', 'myApp.controllers' ]). config(['$routeProvider', function($routeProvider) { $routeProvider.when('/', {templateUrl: 'partials/movie-list.html', controller: 'MovieListCtrl'}); $routeProvider.otherwise({redirectTo: '/'}); }]);
For this application, we'll need only one route and one partial. So, we set /
to point to partials/movie-list.html
and map it to the MovieListCtrl
controller.
Note
Don't forget to rename or create your movie-list.html
file in the partials
folder.