From 4a90165514fbbc8543cdcdd29c16363ddc3ff1b8 Mon Sep 17 00:00:00 2001 From: jcwimer Date: Thu, 18 Feb 2016 15:13:33 +0000 Subject: [PATCH] Added bootstrap and angularjs --- frontend/app/js/app.js | 30 ++++++++++++++++++++++++++ frontend/app/js/hello.js | 14 ------------ frontend/app/pages/index.us | 43 +++++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 frontend/app/js/app.js delete mode 100644 frontend/app/js/hello.js diff --git a/frontend/app/js/app.js b/frontend/app/js/app.js new file mode 100644 index 0000000..34d039c --- /dev/null +++ b/frontend/app/js/app.js @@ -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; + }; + +} \ No newline at end of file diff --git a/frontend/app/js/hello.js b/frontend/app/js/hello.js deleted file mode 100644 index 4a9d1e5..0000000 --- a/frontend/app/js/hello.js +++ /dev/null @@ -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); -} diff --git a/frontend/app/pages/index.us b/frontend/app/pages/index.us index ee2bc1d..fdd4042 100644 --- a/frontend/app/pages/index.us +++ b/frontend/app/pages/index.us @@ -1,11 +1,36 @@ - - - <%= pkg.name %> + + + + + + + +Angular JS Demo + + +

{{rows.length}} Friend{{plural(rows)}} ? (only {{rows.length-1}} actually....)

+
+ + + + - - - - - - + + + + + +
+ + + + + + +
{{$index+1}}{{row}} + +
+ + + \ No newline at end of file