diff --git a/app.js b/app.js new file mode 100644 index 0000000..de86764 --- /dev/null +++ b/app.js @@ -0,0 +1,52 @@ +angular.module("happyApp", []) + + .controller("happyController", function ($scope){ + + $scope.allHappy = []; + + // $scope.newHappy = { + // status : '', + // date : '' + // } + + $scope.addHappy = function () { + $scope.date = new Date (); + + $scope.allHappy.push({ + status : $scope.emoticonSelected, + date : $scope.date + }) + + $scope.emoticonSelected = ""; + + console.log($scope.allHappy); + // angular.forEach(allHappy, function (){ + // console.log(allHappy.status); + // }) + + // $scope.getAverage = function () { + // var averageArray = $scope.allHappy.map(function (string){ + // if (string == 'happy') { + // return 1; + // } else if (string == 'ok') { + // return 0; + // } else { return -1}; + // }) + + // var total = 0; + + // total = averageArray.reduce (function (a,b) { + // return a + b; + // }) + + // var avgerage = total/averageArray.length; + + // if (avgerage >= 0.5) { + // return 'Happy'; + // } else if ( avgerage >= 0) { + // return 'Ok'; + // } else { return 'Sad'}; + // } + + }; +}); \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..ebd0036 --- /dev/null +++ b/index.html @@ -0,0 +1,58 @@ + + +
+