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 ...
Get AngularJS Web Application Development Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.