{"size": 1325, "ext": "js", "max_stars_repo_path": "Ionic-seed/www/js/controllers.js", "max_stars_repo_name": "gerardovivanco/firebase-angular-starter-pack", "max_stars_repo_stars_event_min_datetime": "2015-01-03T23:38:11.000Z", "max_stars_repo_stars_event_max_datetime": "2018-07-24T13:34:13.000Z", "max_issues_repo_path": "Ionic-seed/www/js/controllers.js", "max_issues_repo_name": "MaximRobota/firebase-angular-starter-pack", "max_issues_repo_issues_event_min_datetime": "2015-01-02T19:49:47.000Z", "max_issues_repo_issues_event_max_datetime": "2016-10-17T20:29:54.000Z", "max_forks_repo_path": "Ionic-seed/www/js/controllers.js", "max_forks_repo_name": "MaximRobota/firebase-angular-starter-pack", "max_forks_repo_forks_event_min_datetime": "2015-01-05T19:45:25.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-24T21:36:11.000Z"}
{"max_stars_count": 219, "max_issues_count": 10, "max_forks_count": 179, "avg_line_length": 38.9705882353, "max_line_length": 111, "alphanum_fraction": 0.68}
angular.module('starter.controllers', [])

// Data for this seed is stored in the "ionic-seed" firebase.
// To view the raw data, open https://ionic-seed.firebaseio.com/.json in a browser

// A simple controller that fetches a list of data from a service
.controller('PetIndexCtrl', function($scope, $firebase) {
  // "Pets" is a service returning mock data (services.js)
  var ref = new Firebase('https://ionic-seed.firebaseio.com/pets');
  $scope.pets = $firebase(ref);
})

// A simple controller that shows a tapped item's data
.controller('PetDetailCtrl', function($scope, $stateParams, $firebase) {
  // "Pets" is a service returning mock data (services.js)
  var ref = new Firebase('https://ionic-seed.firebaseio.com/pets/' + $stateParams.petId);
  $scope.pet = $firebase(ref);
})

// A simple controller which adds a new Adopter
.controller('AdoptCtrl', function($scope, $stateParams, $firebase, $log, $location) {

  var ref = new Firebase('https://ionic-seed.firebaseio.com/adopt/');
  $scope.adopters = $firebase(ref);
    
  $scope.createAdopter = function (adopter) {
      var ref = $scope.adopters.$add(adopter);
      $scope.adopter = {};
      $log.info("Your data has been saved to https://ionic-seed.firebaseio.com/adopt/" + ref.name() + ".json");
      alert("Saved!");
      $location.path("/");
  };
});
