From f7358d443bf1081ed3d45b0990456827d18b07f2 Mon Sep 17 00:00:00 2001 From: Jsdwyer26 Date: Tue, 19 Jan 2016 17:37:13 -0800 Subject: [PATCH 1/2] forgot initial commit --- app.js | 43 +++++++++++++++++++++++++++++++++++ index.html | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.css | 0 3 files changed, 109 insertions(+) create mode 100644 app.js create mode 100644 index.html create mode 100644 main.css diff --git a/app.js b/app.js new file mode 100644 index 0000000..1810235 --- /dev/null +++ b/app.js @@ -0,0 +1,43 @@ +//I. Create module...give it a name "app" +var app = angular.module('myApp', []); + +//II. Controller +app.controller('MovieCtrl', ['$scope', function($scope) { + $scope.welcome = 'Test :)'; + $scope.moviesToWatch = [ + { + title: "Ex Machina", + genre: "Action", + year: "2015" + }, + { + title: "Ocean's 11", + genre: "Action", + year: "2000" + }, + { + title: "Burn After Reading", + genre: "Comedy", + year: "2008" + }, + { + title: "There Will Be Blood", + genre: "Drama", + year: "2007" + }, + { + title: "Magnolia", + genre: "Drama", + year: "2000" + } + ]; + $scope.createMovie = function() { + var newMovieAdd = $scope.newMovie; + $scope.moviesToWatch.push(newMovieAdd); + $scope.newMovie = {}; + $scope.newMovieForm = false; + }; + +}]); + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..0580486 --- /dev/null +++ b/index.html @@ -0,0 +1,66 @@ + + + + + Document + + + + + + + +
+
+

Movies


+ + +

+ + +

+ + + + + + + + + + + + + + + +
Movie TitleMovie GenreDate
{{ value.title }}{{ value.genre }}{{ value.year }}
+ + + +
+

Add a movie!

+
+
+ +
+
+ +
+
+ +
+ +
+ +
+ +
+
+ + + + \ No newline at end of file diff --git a/main.css b/main.css new file mode 100644 index 0000000..e69de29 From 13548c412ad828c826734f936b099d0f3e1127b9 Mon Sep 17 00:00:00 2001 From: Jsdwyer26 Date: Tue, 19 Jan 2016 18:10:54 -0800 Subject: [PATCH 2/2] finished challenges --- app.js | 5 +++++ index.html | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 1810235..f0cc88a 100644 --- a/app.js +++ b/app.js @@ -38,6 +38,11 @@ app.controller('MovieCtrl', ['$scope', function($scope) { $scope.newMovieForm = false; }; + $scope.deleteMovie = function(movie) { + var movieIndex = $scope.movies.indexOf(movie); + $scope.movies.splice(movieIndex, 1); + }; + }]); diff --git a/index.html b/index.html index 0580486..bc6cfa5 100644 --- a/index.html +++ b/index.html @@ -13,8 +13,11 @@

Movies


- - + + + + +

Movie Title Movie Genre Date + View + Delete - - + + {{ value.title }} {{ value.genre }} {{ value.year }} + + - +