Skip to content

Instantly share code, notes, and snippets.

@jashmenn
Last active August 29, 2015 13:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jashmenn/8739490 to your computer and use it in GitHub Desktop.
Save jashmenn/8739490 to your computer and use it in GitHub Desktop.
// app/assets/javascripts/app/controllers/movies.js
'use strict';
angular.module('popcornApp')
.controller('MoviesController', ["$scope",
function($scope) {
$scope.movies = [
{
youtubeId: "8Eg6yIwP2vs",
title: "The Royal Tenenbaums",
released: "2001",
rated: "R",
runningTime: 92,
isFavorite: true,
posterUrl: "http://i.imgur.com/np5EP3N.jpg"
},
{
youtubeId: "lgo3Hb5vWLE",
title: "Requiem for a Dream",
released: "2000",
rated: "R",
runningTime: 102,
isFavorite: false,
posterUrl: "http://i.imgur.com/AYiim1H.jpg"
},
{
youtubeId: "hsdvhJTqLak",
title: "The Graduate",
released: "1967",
rated: "R",
runningTime: 106,
isFavorite: true,
posterUrl: "http://i.imgur.com/gMwiOAD.jpg"
},
{
youtubeId: "OtDQOF_pU8A",
title: "8½",
released: "1963",
rated: "R",
runningTime: 138,
isFavorite: false,
posterUrl: "http://i.imgur.com/QIPF827.jpg"
},
{
youtubeId: "r_GCRFRcWxA",
title: "The Big Lebowski",
released: "1998",
rated: "R",
runningTime: 117,
isFavorite: true,
posterUrl: "http://i.imgur.com/AThCwkm.jpg"
},
{
youtubeId: "KYz2wyBy3kc",
title: "Toy Story",
released: "1995",
rated: "G",
runningTime: 81,
isFavorite: true,
posterUrl: "http://i.imgur.com/NtnxM9p.jpg"
}
];
}]);
@orthodoc
Copy link

Shouldn't the 5th line be:

angular.module('popcornApp, [])

If you're copying the contents into app.js, like I was in the beginning of the tutorial, then the empty array is required. However towards the later stages, the controller is moved into a file of its own, just as its listed in the first line. At that point the empty array isn't required as it is employing the setter method. The former, on the other hand is a getter method as elaborated by Nate in the tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment