From 38dc8407d47d06d9dca6c0f97738a15829836fd4 Mon Sep 17 00:00:00 2001 From: Tomas Bocanera Date: Fri, 13 Nov 2015 18:59:09 -0300 Subject: [PATCH] Bocanera Tomas SweatworksInterview Test --- controller.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- index.html | 26 ++++++++++++++++---------- numbers.html | 7 +++++++ styles.css | 17 +++++++++++++++++ 4 files changed, 88 insertions(+), 12 deletions(-) create mode 100644 numbers.html diff --git a/controller.js b/controller.js index 9354734..837e10d 100644 --- a/controller.js +++ b/controller.js @@ -1,4 +1,50 @@ angular.module('test', []) .controller('testController', ['$scope', function($scope) { - -}]); \ No newline at end of file + $scope.values = { + minValue: 0, + maxValue: 1 + }; + + $scope.numberTypes = { + evenNumbers: false, + oddNumbers: false + }; + + $scope.updateList = function (){ + $scope.numbers = []; + for(var i=$scope.values.minValue; i <= $scope.values.maxValue; i++){ + $scope.numbers.push(i); + } + }; + + $scope.displayOnTheLeft = function () { + $scope.displayOnClass = "on-left-side"; + }; + + $scope.displayOnTheRight = function () { + $scope.displayOnClass = "on-right-side"; + }; + + $scope.showAll = function() { + $scope.numberTypes.evenNumbers = false; + $scope.numberTypes.oddNumbers = false; + }; + + $scope.showEvens = function() { + $scope.numberTypes.evenNumbers = true; + $scope.numberTypes.oddNumbers = false; + }; + + $scope.showOdds = function() { + $scope.numberTypes.evenNumbers = false; + $scope.numberTypes.oddNumbers = true; + }; + + $scope.updateList(); +}]) +.directive('numbers', function() { + return { + restrict: 'E', + templateUrl: 'numbers.html' + }; +}); \ No newline at end of file diff --git a/index.html b/index.html index 4079a43..7eb24d4 100644 --- a/index.html +++ b/index.html @@ -8,25 +8,31 @@
-
- - -
+
+ + +
+ Min Number required. +
+
+ Max Number required. +
+
- - - + + +
- - + +
- +
diff --git a/numbers.html b/numbers.html new file mode 100644 index 0000000..740e3e4 --- /dev/null +++ b/numbers.html @@ -0,0 +1,7 @@ +
+
+
+ {{number}} +
+
+
\ No newline at end of file diff --git a/styles.css b/styles.css index 49ac741..727523c 100644 --- a/styles.css +++ b/styles.css @@ -26,4 +26,21 @@ html, body { .buttons-holder { float: right; +} + +.list { + padding: 20px; + color: white; +} + +.on-left-side { + float: left; +} + +.on-right-side { + float: right; +} + +.error { + color:red; } \ No newline at end of file