AngularJS: Delete button working in main page but not in in-depth view page?

I updated the codes with a set of codes, which uses $rootScope.

After that, my delete button no longer works in the post view page, but it still works in the main post page. Both delete button uses the same code.

Any suggestions how to test whats causing the errors or display some error codes to identify the problem area?

Attached is a plunkr that somewhat resembles the basic issue. (Delete code is different) http://plnkr.co/edit/I2qrAznO3cTHjos3FqUm?p=preview


html

<ion-view ng-controller="PostViewCtrl">
<a ng-click="deletePost(post)">DELETE</a>


js for delete function

app.controller('PostViewCtrl', function($scope, $stateParams, Post, Auth) {

      $scope.deletePost = function(post) {   //delete function action
        Post.delete(post);
      };


factory for delete function

app.factory('Post', function($firebase, FIREBASE_URL) {

  var Post = {
    all: posts,
    delete: function (post) {    //delete function from factory
      return posts.$remove(post);
    },


This is the new code added which broke the delete function

app.factory('Geolocation', function($q, $window, $rootScope) { 
    return function () {
        var deferred = $q.defer();
             etc.......