Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .controller('tipController', function($scope) {
- // Numpad
- $scope.checkTotal = '0.00';
- $scope.clicked = function (label) {
- if($scope.checkTotal === '0.00') {
- $scope.checkTotal = label;
- } else {
- $scope.checkTotal += label;
- }
- };
- // Prevent multiple decimals
- $scope.clickedDot = function() {
- if (($scope.checkTotal.indexOf('.') < 0) || ($scope.checkTotal === '0.00')) {
- if ($scope.checkTotal === '0.00') {
- $scope.checkTotal = '0.';
- } else {
- $scope.checkTotal += '.';
- }
- }
- };
- $scope.del = function () {
- $scope.checkTotal.substring(0, length - 1);
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement