From 40884e678157b2316a5207ff55c1b4a250814d69 Mon Sep 17 00:00:00 2001 From: Sergio Date: Fri, 13 Nov 2015 19:22:04 -0300 Subject: [PATCH 1/3] Changed directory structure, file routes and script tags --- index.html | 6 +++--- angular.js => js/angular.js | 0 controller.js => js/controller.js | 0 styles.css => style/styles.css | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename angular.js => js/angular.js (100%) rename controller.js => js/controller.js (100%) rename styles.css => style/styles.css (100%) diff --git a/index.html b/index.html index 4079a43..266f7f5 100644 --- a/index.html +++ b/index.html @@ -1,9 +1,7 @@ - - - +
@@ -29,5 +27,7 @@
+ + \ No newline at end of file diff --git a/angular.js b/js/angular.js similarity index 100% rename from angular.js rename to js/angular.js diff --git a/controller.js b/js/controller.js similarity index 100% rename from controller.js rename to js/controller.js diff --git a/styles.css b/style/styles.css similarity index 100% rename from styles.css rename to style/styles.css From cbc640847a1295ba7b91080280bd9aaadca96d96 Mon Sep 17 00:00:00 2001 From: Sergio Date: Fri, 13 Nov 2015 20:46:40 -0300 Subject: [PATCH 2/3] Added all logic to make it functional --- index.html | 56 ++++++++++++++++++++++++++---------------------- js/app.js | 4 ++++ js/controller.js | 33 ++++++++++++++++++++++++---- js/directive.js | 8 +++++++ js/filters.js | 8 +++++++ 5 files changed, 79 insertions(+), 30 deletions(-) create mode 100644 js/app.js create mode 100644 js/directive.js create mode 100644 js/filters.js diff --git a/index.html b/index.html index 266f7f5..1ebb76d 100644 --- a/index.html +++ b/index.html @@ -1,33 +1,37 @@ + - + - -
-
-
- - -
-
- - - -
-
-
-
- - -
-
-
- -
-
- - + +
+
+
+ + +
+
+ + + +
+
+
+
+ + +
+
+
+ +
+
+ + + + + \ No newline at end of file diff --git a/js/app.js b/js/app.js new file mode 100644 index 0000000..cc61998 --- /dev/null +++ b/js/app.js @@ -0,0 +1,4 @@ +angular.module('testApp', [ + 'controller', + 'directive' +]); diff --git a/js/controller.js b/js/controller.js index 9354734..17537a5 100644 --- a/js/controller.js +++ b/js/controller.js @@ -1,4 +1,29 @@ -angular.module('test', []) -.controller('testController', ['$scope', function($scope) { - -}]); \ No newline at end of file +angular.module('controller', []) + .controller('testController', ['$scope', function($scope) { + + $scope.oddArray = function() { + $scope.listValues = []; + for (var i = $scope.minValue; i <= $scope.maxValue; i++) { + if (i % 2 !== 0) { + $scope.listValues.push(i); + } + } + }; + + $scope.evenArray = function() { + $scope.listValues = []; + for (var i = $scope.minValue; i <= $scope.maxValue; i++) { + if (i % 2 === 0) { + $scope.listValues.push(i); + } + } + }; + + $scope.listArray = function() { + $scope.listValues = []; + for (var i = $scope.minValue; i <= $scope.maxValue; i++) { + $scope.listValues.push(i); + } + }; + + }]); \ No newline at end of file diff --git a/js/directive.js b/js/directive.js new file mode 100644 index 0000000..f1c3d2b --- /dev/null +++ b/js/directive.js @@ -0,0 +1,8 @@ +angular.module('directive', []) + .directive('testDirective', function() { + + return { + restrict: 'EA', // E = Element, A = Attribute, C = Class, M = Comment + template: '
{{value}}

', + }; + }); \ No newline at end of file diff --git a/js/filters.js b/js/filters.js new file mode 100644 index 0000000..9232542 --- /dev/null +++ b/js/filters.js @@ -0,0 +1,8 @@ +angular.module('filters', []) + .directive('testFilters', function() { + + return { + restrict: 'EA', // E = Element, A = Attribute, C = Class, M = Comment + template: '
{{value}}

', + }; + }); \ No newline at end of file From 445094d52f08fa39b419f38dca2f36d8d8d0dad2 Mon Sep 17 00:00:00 2001 From: Sergio Date: Mon, 16 Nov 2015 11:37:23 -0300 Subject: [PATCH 3/3] deleted filters.js added some comments --- index.html | 11 ++++++++++- js/controller.js | 6 +++--- js/directive.js | 2 +- js/filters.js | 8 -------- 4 files changed, 14 insertions(+), 13 deletions(-) delete mode 100644 js/filters.js diff --git a/index.html b/index.html index 1ebb76d..9f0133d 100644 --- a/index.html +++ b/index.html @@ -4,8 +4,9 @@ - + +
@@ -13,20 +14,28 @@
+ +
+ +
+
+ +
+
diff --git a/js/controller.js b/js/controller.js index 17537a5..ef66554 100644 --- a/js/controller.js +++ b/js/controller.js @@ -1,6 +1,6 @@ angular.module('controller', []) .controller('testController', ['$scope', function($scope) { - + //creates an array of odd numbers between the 2 input numbers $scope.oddArray = function() { $scope.listValues = []; for (var i = $scope.minValue; i <= $scope.maxValue; i++) { @@ -9,7 +9,7 @@ angular.module('controller', []) } } }; - + //creates an array of Even numbers between the 2 input numbers $scope.evenArray = function() { $scope.listValues = []; for (var i = $scope.minValue; i <= $scope.maxValue; i++) { @@ -18,7 +18,7 @@ angular.module('controller', []) } } }; - + //creates an array of numbers between the 2 input numbers $scope.listArray = function() { $scope.listValues = []; for (var i = $scope.minValue; i <= $scope.maxValue; i++) { diff --git a/js/directive.js b/js/directive.js index f1c3d2b..9df929a 100644 --- a/js/directive.js +++ b/js/directive.js @@ -1,6 +1,6 @@ angular.module('directive', []) .directive('testDirective', function() { - + // This directive display the values calculated in the controller functions return { restrict: 'EA', // E = Element, A = Attribute, C = Class, M = Comment template: '
{{value}}

', diff --git a/js/filters.js b/js/filters.js deleted file mode 100644 index 9232542..0000000 --- a/js/filters.js +++ /dev/null @@ -1,8 +0,0 @@ -angular.module('filters', []) - .directive('testFilters', function() { - - return { - restrict: 'EA', // E = Element, A = Attribute, C = Class, M = Comment - template: '
{{value}}

', - }; - }); \ No newline at end of file