diff --git a/ng-app/viv_ng_basic.js b/ng-app/viv_ng_basic.js new file mode 100644 index 0000000..3a4c9dd --- /dev/null +++ b/ng-app/viv_ng_basic.js @@ -0,0 +1,86 @@ + +app.controller('myCtrl', function($scope) { + + $scope.c_value="5"; + + $scope.addOne = function() { + $scope.c_value += "1"; + } + + $scope.clear = function() { + $scope.c_value = ""; + } + $scope.addTwo = function() { + $scope.c_value += "2"; + } + + $scope.addThree = function() { + $scope.c_value += "3"; + } + + $scope.addFour = function() { + $scope.c_value += "4"; + } + + $scope.addFive = function() { + $scope.c_value += "5"; + } + + $scope.addSix = function() { + $scope.c_value += "6"; + } + + $scope.addSeven = function() { + $scope.c_value += "7"; + } + $scope.addEight = function() { + $scope.c_value += "8"; + } + + $scope.addNine = function() { + $scope.c_value += "9"; + } + $scope.addZero = function() { + $scope.c_value += "0"; + } + + $scope.addDecimal = function() { + $scope.c_value += "."; + } + + $scope.addPlus = function() { + $scope.c_value += "+" + } + + $scope.addMinus = function() { + $scope.c_value += "-"; + } + + $scope.addMulti = function() { + $scope.c_value += "*"; + } + + $scope.addDivide = function() { + $scope.c_value += "/"; + } + + $scope.addMod = function() { + $scope.c_value += "%"; + } + + $scope.solveAdd = function() { + $scope.c_value = $scope.$eval($scope.c_value); + } + + $scope.solveSubtract = function() { + $scope.c_value += "0"; + } + + $scope.solveFraction = function() { + $scope.c_value = 1/$scope.$eval($scope.c_value); + } + + + + +}); \ No newline at end of file