// Change for your parse credentials here and remove the alert
alert('Change for your parse credentials here and remove the alert');
// https://parse.com/apps/quickstart#js/existing
Parse.initialize("39K854oGN1b7ymXFtowNZzhEqj3YZLkoaMWQ1NQa", "PGA5eE28umojIopJXARZaInoU7LGgNUiwwY0xGn3");

var app = angular.module('plunker', ['angularParse']);

app.controller('MainCtrl', function($scope, $timeout, parsePersistence, parseQuery) {

  $scope.data = { 
    items: [],
    total: 0
  }
  
  // adds a new object to server
  $scope.add = function() {
    
    var testObject = parsePersistence.new('TestObject');
    
    parsePersistence.save(testObject, {foo: "bar promise"})
    .then(function(object) { 
      $scope.data.items.push(object);
      $scope.data.total++;
    }, function(error) {
      alert(JSON.stringify(error));
    });
  }
  
  // retrieve a list of 10 items from server and the total number of items
  $scope.find = function() {

    var query = parseQuery.new('TestObject').limit(10);
    
    parseQuery.find(query)
    .then(function(results) {
      $scope.data.items = results;
      
      // nested promise :)
      return parseQuery.count(query);
    })
   .then(function(total) {
      $scope.data.total = total;
    }, function(error) {
      alert(JSON.stringify(error));
    });
    
  };
  
  // removes an object from server
  $scope.destroy = function(obj) {
   
    parsePersistence.destroy(obj)
    .then(function(result) {
      $scope.data.items.splice($scope.data.items.indexOf(obj),1);
      $scope.data.total--;
    }, function(error) {
      alert(JSON.stringify(error));
    });
    
  }
  
});
<!DOCTYPE html>
<html ng-app="plunker">

  <head>
    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>
    <script>document.write('<base href="' + document.location + '" />');</script>
    <link rel="stylesheet" href="style.css" />
    <script data-require="angular.js@1.1.x" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js" data-semver="1.1.5"></script>
    <script src="http://www.parsecdn.com/js/parse-1.2.15.min.js"></script>
    <script src="https://rawgithub.com/felipesabino/angular-parse/0.1.0/angularparse.js"></script>
    <script src="app.js"></script>
    
  </head>

  <body ng-controller="MainCtrl">
    <button ng-click="add()">Add item</button>
    <button ng-click="find()">Find all</button>
    <p ng-show="data.items.length > 0">Showing {{data.items.length}} of {{data.total}} </p>
    
    <ul>
      <li ng-repeat="item in data.items">(#{{item.id}}) {{item.createdAt}} - <a href="#" ng-click="destroy(item)">destroy</a></li>
    </ul>
    
  </body>

</html>
/* Put your css in here */