function SpeedmonitorController($scope) { // The current url we're preparing to add. $scope.currentUrl = ""; // In this array, we'll keep track of the urls and their last fetch time. $scope.urls = [{url: "www.google.com", loadSpeed: 50}, {url: "angularjs.org", loadSpeed: 75}, {url: "www.dwmkerr.com", loadSpeed: 120}]; // Adds an url. $scope.addUrl = function() { $scope.urls.push({url: $scope.currentUrl, loadSpeed: Math.random() * 75 + 50}); }; // Remove an url. $scope.removeUrl = function(index) { $scope.urls.splice(index, 1); }; }