Hi I am new to AngularJS and Ionic. I have successfully completed the todo app tutorial and trying to implement edit task function using ion-list options-buttons like,
<ion-list option-buttons="taskButtons">
<ion-item ng-repeat="task in activeProject.tasks"
item="task">
{{ task.title }}
</ion-item>
</ion-list>
$scope.taskButtons = [
{
text: 'Delete',
type: 'button-assertive',
onTap: function(task) {
$scope.deleteTask(task);
}
},
{
text: 'Edit',
type: 'button-calm',
onTap: function(task) {
alert('Edit Item: ' + task.title);
$scope.editTask(task);
}
}
];
Now I am having issues assigning task.title to ng-model in my template.
$scope.editTask = function(task) {
$scope.edittask.title = task.title;
$scope.editTaskModal.show();
}
I am getting this error,
TypeError: Cannot set property 'title' of undefined
at Scope.$scope.editTask
at Object.$scope.taskButtons.onTap
what i am doing wrong or how to assign the selected task title to the ng-model so user can edit the task. kindly help me on this.