'use strict'; /** * @ngdoc function * @name kasseApp.controller:AboutCtrl * @description * # AboutCtrl * Controller of the kasseApp */ angular.module('kasseApp') .controller('OverviewCtrl', function ($scope) { $scope.Produkte = [ "btn-primary", "btn-info", "btn-darkgreen", "btn-success", "btn-warning" ]; $scope.Bestellungen = JSON.parse(window.localStorage.getItem("OffeneBestellungen")); $("body").keypress(function (event) { var key = event.which - 49; if (key >= 0 && key < $scope.Bestellungen.length) { $scope.removeItem(key); console.log(key); } }); $scope.removeItem = function (index) { $scope.Bestellungen = $scope.Bestellungen.splice(index, 1); }; });