1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-01 03:55:44 +00:00
Files
wrestlingdev.com/frontend/app/js/app.js
2016-02-18 15:13:33 +00:00

30 lines
662 B
JavaScript

function ctrl($scope){
$scope.rows = ['Paul','John','Lucie'];
$scope.temp = false;
$scope.addRow = function(){
$scope.temp = false;
$scope.addName="";
};
$scope.deleteRow = function(row){
$scope.rows.splice($scope.rows.indexOf(row),1);
};
$scope.plural = function (tab){
return tab.length > 1 ? 's': '';
};
$scope.addTemp = function(){
if($scope.temp) $scope.rows.pop();
else if($scope.addName) $scope.temp = true;
if($scope.addName) $scope.rows.push($scope.addName);
else $scope.temp = false;
};
$scope.isTemp = function(i){
return i==$scope.rows.length-1 && $scope.temp;
};
}