mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-06 22:44:14 +00:00
Added bootstrap and angularjs
This commit is contained in:
30
frontend/app/js/app.js
Normal file
30
frontend/app/js/app.js
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
window.helloText = function() {
|
||||
return 'Hello, World!';
|
||||
};
|
||||
|
||||
window.hello = function() {
|
||||
html = JST['app/templates/hello.us']({text: helloText()});
|
||||
document.body.innerHTML += html;
|
||||
};
|
||||
|
||||
if(window.addEventListener) {
|
||||
window.addEventListener('DOMContentLoaded', hello, false);
|
||||
} else {
|
||||
window.attachEvent('onload', hello);
|
||||
}
|
||||
Reference in New Issue
Block a user