I can't update my selected item from $ionicpopup

i can’t update my selected item from $ionicpopup

when i click edit button it shows me message

ionic.bundle.js:21162 TypeError: Cannot read property ‘$id’ of undefined
at Object.Task.editTask (task.js:54)
at $ionicPopup.show.buttons.onTap (browseDetail.js:81)
at Scope.extend.$buttonTapped (ionic.bundle.js:49350)
at fn (eval at (ionic.bundle.js:21977), :4:386)
at ionic.bundle.js:57606
at Scope.$eval (ionic.bundle.js:24678)
at Scope.$apply (ionic.bundle.js:24777)
at HTMLButtonElement. (ionic.bundle.js:57605)
at HTMLButtonElement.eventHandler (ionic.bundle.js:12103)
at triggerMouseEvent (ionic.bundle.js:2870)

this is my code

service

editTask: function (task) {
var t = this.getTask(task.$id);
return t.$update({
title: task.title,
school: task.school,

});
},

controler

$scope.editTask = function(){

 var myPopup = $ionicPopup.show({
   templateUrl: 'templates/partials/postEdit.html',
   title: 'Edit',
   scope: $scope,
   buttons: [
     { text: '<b>Delet </b>',
       type: 'button-calm'
     },

     {
       text: '<b>Edit</b>',
       type: 'button-calm',
       onTap: function (task) {
         task = $scope.task;
         Task.editTask(task).then(function() {
     });
         $state.go('tabsController.browse');

       }
     }
   ]
 });

};

any help