Advertisement
sombriks

agenda.js

Jun 5th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function AgendaCtrl($scope){
  3.    
  4.     $scope.lista = [];
  5.    
  6.     $scope.item = {};
  7.    
  8.     $scope.salvar = function(){
  9.         if(!$scope.item.id){
  10.             $scope.item.id = new Date().getTime();
  11.             $scope.lista.unshift($scope.item);
  12.         }
  13.         $scope.item = {};
  14.     };
  15.    
  16.     $scope.editar = function(i){
  17.         $scope.item = $scope.lista[i];
  18.     };
  19.    
  20.     $scope.excluir = function(i){
  21.         $scope.lista.splice(i,1);
  22.         $scope.item = {};
  23.     };
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement