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