From 588d4d0973526507d4d73a385cfbbd44d6bf523a Mon Sep 17 00:00:00 2001 From: DreTGiant Date: Tue, 19 Jan 2016 23:37:04 -0800 Subject: [PATCH 1/2] first commit --- app.js | 26 ++++++++++++++++++++++++++ index.html | 29 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 app.js create mode 100644 index.html diff --git a/app.js b/app.js new file mode 100644 index 0000000..e9e51b7 --- /dev/null +++ b/app.js @@ -0,0 +1,26 @@ +(function(){ + +var app = angular.module('movieApp', []); + + app.controller('MovieCtrl', ['$scope', function($scope){ + $scope.moviesToWatch =[ + { + name: "John Wick" + }, + { + name: "The Green Mile" + }, + { + name: "The Intouchables" + }, + { + name: "Creed" + }]; + + $scope.createMovie = function(){ + $scope.moviesToWatch.push($scope.newMovie); + $scope.newMovie = {}; + $scope.newMovieForm = false; + }; + }]); +})(); \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..7614004 --- /dev/null +++ b/index.html @@ -0,0 +1,29 @@ + + + + + + + + + Augular Practice + + +
+

{{movie.name}}

+
+ +
+
+ + +
+
+ + + +
+

{{moviesToWatch.length}} movies to watch

+
+ + \ No newline at end of file From 53126a4e05ec00e5adcd7ad6a0986b4d3187c946 Mon Sep 17 00:00:00 2001 From: DreTGiant Date: Tue, 19 Jan 2016 23:41:45 -0800 Subject: [PATCH 2/2] fully functional --- app.js | 4 ++++ index.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index e9e51b7..ccf508a 100644 --- a/app.js +++ b/app.js @@ -22,5 +22,9 @@ var app = angular.module('movieApp', []); $scope.newMovie = {}; $scope.newMovieForm = false; }; + $scope.deleteMovie = function(movie){ + var movieIndex = $scope.moviesToWatch.indexOf(movie); + $scope.moviesToWatch.splice(movieIndex,1); + } }]); })(); \ No newline at end of file diff --git a/index.html b/index.html index 7614004..a9a187d 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@
-

{{movie.name}}

+

{{movie.name}} Delete Pet