O'Reilly logo

Node.js, MongoDB, and AngularJS Web Development by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Full Controller

Listing 28.29 shows the full myApp code, with the shoppingController initialization and all the controller code together so you can see how everything fits together. Notice that the shoppingController definition includes dependencies on $scope, $http, and $window. The $window dependency allows you to add the browser alert message when errors occur.

Listing 28.29 cart_app.js-full: Implementing an application that supports keeping track of items in a shopping cart and handling the checkout process

001 var app = angular.module('myApp', []);002 app.controller('shoppingController', ['$scope', '$http', '$window',003                               function($scope, $http, $window) {004     $scope.months ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required